Commits

Junio C Hamano  committed 9f44723 Merge

Merge branch 'en/d-f-conflict-fix'

* en/d-f-conflict-fix:
fast-export: ensure that a renamed file is printed after all references

  • Participants
  • Parent commits 7505ae2, 4ce6fb8

Comments (0)

Files changed (1)

File builtin/fast-export.c

 	cmp = memcmp(name_a, name_b, len);
 	if (cmp)
 		return cmp;
-	return (len_b - len_a);
+	cmp = len_b - len_a;
+	if (cmp)
+		return cmp;
+	/*
+	 * 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,