Skip to content

Commit 52ea296

Browse files
committed
diffcore-rename: allow easier debugging
Call diff_debug_queue() once before we munge the output queue, and do not give the same contents of the queue twice. Signed-off-by: Junio C Hamano <[email protected]>
1 parent e41b208 commit 52ea296

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

diffcore-rename.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,12 @@ void diffcore_rename(struct diff_options *options)
642642
free(mx);
643643

644644
cleanup:
645-
/* At this point, we have found some renames and copies and they
645+
/*
646+
* At this point, we have found some renames and copies and they
646647
* are recorded in rename_dst. The original list is still in *q.
647648
*/
649+
diff_debug_queue("begin turning a/d into renames", q);
650+
648651
DIFF_QUEUE_CLEAR(&outq);
649652
for (i = 0; i < q->nr; i++) {
650653
struct diff_filepair *p = q->queue[i];
@@ -657,8 +660,9 @@ void diffcore_rename(struct diff_options *options)
657660
/*
658661
* Creation
659662
*
660-
* We would output this create record if it has
661-
* not been turned into a rename/copy already.
663+
* Did the content come from somewhere else?
664+
* If so, show that as a rename. Otherwise
665+
* show it as a creation (i.e. as-is).
662666
*/
663667
struct diff_rename_dst *dst =
664668
locate_rename_dst(p->two, 0);
@@ -718,11 +722,10 @@ void diffcore_rename(struct diff_options *options)
718722
if (pair_to_free)
719723
diff_free_filepair(pair_to_free);
720724
}
721-
diff_debug_queue("done copying original", &outq);
722725

723726
free(q->queue);
724727
*q = outq;
725-
diff_debug_queue("done collapsing", q);
728+
diff_debug_queue("end turning a/d into renames", q);
726729

727730
for (i = 0; i < rename_dst_nr; i++)
728731
free_filespec(rename_dst[i].two);

0 commit comments

Comments
 (0)