cmp = memcmp(name_a, name_b, len);
- return (len_b - len_a);
+ * Move 'R'ename entries last so that all references of the file
+ * appear in the output before it is renamed (e.g., when a file
+ * was copied and renamed in the same commit).
+ return (a->status == 'R') - (b->status == 'R');
static void show_filemodify(struct diff_queue_struct *q,