summaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-03-29 16:39:09 +0900
committerJunio C Hamano <gitster@pobox.com>2025-03-29 16:39:09 +0900
commitb9b404fa1cdb43a54962188d883fafb5d2f9912d (patch)
treefb40e5d42b6882b3457726ad8af692e55d2d3fa9 /diffcore-rename.c
parent27fe152e887ad49ed06580d4baa56371eaade289 (diff)
parent554051d6917cf87aa00152290c644cf76e0e3c3c (diff)
Merge branch 'en/diff-rename-follow-fix'
A corner-case bug in "git log --follow -B" has been fixed. * en/diff-rename-follow-fix: diffcore-rename: fix BUG when break detection and --follow used together
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 91b77993c7..5002e896aa 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -33,7 +33,7 @@ static struct diff_rename_dst *locate_rename_dst(struct diff_filepair *p)
{
/* Lookup by p->ONE->path */
int idx = break_idx ? strintmap_get(break_idx, p->one->path) : -1;
- return (idx == -1) ? NULL : &rename_dst[idx];
+ return (idx == -1 || idx == rename_dst_nr) ? NULL : &rename_dst[idx];
}
/*
@@ -1669,9 +1669,10 @@ void diffcore_rename_extended(struct diff_options *options,
if (DIFF_PAIR_BROKEN(p)) {
/* broken delete */
struct diff_rename_dst *dst = locate_rename_dst(p);
- if (!dst)
- BUG("tracking failed somehow; failed to find associated dst for broken pair");
- if (dst->is_rename)
+ if (options->single_follow && dst &&
+ strcmp(dst->p->two->path, p->two->path))
+ dst = NULL;
+ if (dst && dst->is_rename)
/* counterpart is now rename/copy */
pair_to_free = p;
}