aboutsummaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-06-11 20:55:20 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-12 20:40:19 -0700
commit2210100ac00b8a46f1d94c044391bfa50b25afa4 (patch)
tree76aeba1897c592e1965533a2cb8771671bd747ed /diffcore-rename.c
parenta7fa68c5f942706fce5636b9136d1b229e089190 (diff)
downloadgit-2210100ac00b8a46f1d94c044391bfa50b25afa4.tar.gz
git-2210100ac00b8a46f1d94c044391bfa50b25afa4.tar.xz
[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>
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 19325f245..8fb45f0b8 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -249,8 +249,14 @@ void diffcore_rename(int detect_rename, int minimum_score)
continue; /* unmerged */
else
locate_rename_dst(p->two, 1);
- else if (!DIFF_FILE_VALID(p->two))
- register_rename_src(p->one, 0);
+ else if (!DIFF_FILE_VALID(p->two)) {
+ /* 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)
register_rename_src(p->one, 1);
}