Browse Source

[PATCH] Fix rename/copy when dealing with temporarily broken pairs.

When rename/copy uses a file that was broken by diffcore-break
as the source, and the broken filepair gets merged back later,
the output was mislabeled as a rename.  In this case, the source
file ends up staying in the output, so we should label it as a
copy instead.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
maint
Junio C Hamano 20 years ago committed by Linus Torvalds
parent
commit
2210100ac0
  1. 1
      diff.c
  2. 10
      diffcore-rename.c

1
diff.c

@ -662,6 +662,7 @@ struct diff_filepair *diff_queue(struct diff_queue_struct *queue,
dp->one = one; dp->one = one;
dp->two = two; dp->two = two;
dp->score = 0; dp->score = 0;
dp->status = 0;
dp->source_stays = 0; dp->source_stays = 0;
dp->broken_pair = 0; dp->broken_pair = 0;
diff_q(queue, dp); diff_q(queue, dp);

10
diffcore-rename.c

@ -249,8 +249,14 @@ void diffcore_rename(int detect_rename, int minimum_score)
continue; /* unmerged */ continue; /* unmerged */
else else
locate_rename_dst(p->two, 1); locate_rename_dst(p->two, 1);
else if (!DIFF_FILE_VALID(p->two)) else if (!DIFF_FILE_VALID(p->two)) {
register_rename_src(p->one, 0); /* If the source is a broken "delete", and
* they did not really want to get broken,
* that means the source actually stays.
*/
int stays = (p->broken_pair && !p->score);
register_rename_src(p->one, stays);
}
else if (detect_rename == DIFF_DETECT_COPY) else if (detect_rename == DIFF_DETECT_COPY)
register_rename_src(p->one, 1); register_rename_src(p->one, 1);
} }

Loading…
Cancel
Save