diff options
author | Russell Belfer <rb@github.com> | 2013-08-05 01:06:13 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-08-05 01:06:13 +0400 |
commit | 7edb74d374f401cea50be143b63c7d2d141d18be (patch) | |
tree | 7d26d7920ec45fe53ea803bed6be784f0b373b6e /src/diff_tform.c | |
parent | a42c2a8c89189afbcfccbc17f798971c18c15de6 (diff) |
Update rename src map for any split src
When using a rename source that is actually a to-be-split record,
we have to update the best-fit mapping data in both the case where
the target is also a split record and the case where the target
is a simple added record. Before this commit, we were only doing
the update when the target was itself a split record (and even in
that case, the test was slightly wrong).
Diffstat (limited to 'src/diff_tform.c')
-rw-r--r-- | src/diff_tform.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/diff_tform.c b/src/diff_tform.c index 92c4036fb..ba35d3c14 100644 --- a/src/diff_tform.c +++ b/src/diff_tform.c @@ -947,6 +947,11 @@ find_best_matches: src->new_file.flags |= GIT_DIFF_FLAG_VALID_OID; num_updates++; + + if (src2tgt[t].similarity > 0 && src2tgt[t].idx > t) { + /* what used to be at src t is now at src s */ + tgt2src[src2tgt[t].idx].idx = (uint32_t)s; + } } } @@ -996,7 +1001,7 @@ find_best_matches: num_rewrites--; } /* otherwise, if we just overwrote a source, update mapping */ - else if (s > t && src2tgt[t].similarity > 0) { + else if (src2tgt[t].similarity > 0 && src2tgt[t].idx > t) { /* what used to be at src t is now at src s */ tgt2src[src2tgt[t].idx].idx = (uint32_t)s; } |