summaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index f3dc434db1..d7322af876 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -685,12 +685,24 @@ void diffcore_rename(struct diff_options *options)
} else if (DIFF_FILE_VALID(p->one) && !DIFF_FILE_VALID(p->two)) {
/*
* Deletion
- *
- * Did the content go to somewhere?
*/
struct diff_rename_src *src =
locate_rename_src(p->one, 0);
- if (!src || !src->p->one->rename_used) {
+ int keep_deletion = 0;
+
+ if (DIFF_PAIR_BROKEN(p)) {
+ struct diff_rename_dst *dst =
+ locate_rename_dst(p->one, 0);
+ /* If nobody swaps in other contents here... */
+ if (!(dst && dst->pair))
+ keep_deletion = 1;
+ } else {
+ /* It did not go anywhere? Then keep deletion */
+ if (!src || !src->p->one->rename_used)
+ keep_deletion = 1;
+ }
+
+ if (keep_deletion) {
diff_q(&outq, p);
q->queue[i] = NULL;
}