aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--diff.c1
-rw-r--r--diffcore-rename.c10
2 files changed, 9 insertions, 2 deletions
diff --git a/diff.c b/diff.c
index dd1c0b6d5..d6661f826 100644
--- a/diff.c
+++ b/diff.c
@@ -662,6 +662,7 @@ struct diff_filepair *diff_queue(struct diff_queue_struct *queue,
dp->one = one;
dp->two = two;
dp->score = 0;
+ dp->status = 0;
dp->source_stays = 0;
dp->broken_pair = 0;
diff_q(queue, dp);
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);
}