diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2015-04-19 19:58:03 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-04-19 19:58:03 -0400 |
commit | 08c45213b164fdb456c1b19b98039365c8f0cf98 (patch) | |
tree | be53b3cc6ad604849bde3f429ed40afcf8ad78e2 | |
parent | 4c02d393748d0db382450871ad9ef6898a2ce360 (diff) | |
parent | b978082312aab505771c85227542382db054e304 (diff) | |
download | libgit2-08c45213b164fdb456c1b19b98039365c8f0cf98.tar.gz |
Merge pull request #3024 from git-up/diff_merge_fix
Make sure to also update delta->nfiles when merging diffs
-rw-r--r-- | src/diff_tform.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/diff_tform.c b/src/diff_tform.c index 06c12308b..7d8463573 100644 --- a/src/diff_tform.c +++ b/src/diff_tform.c @@ -84,11 +84,14 @@ static git_diff_delta *diff_delta__merge_like_cgit( * index (i.e. not in HEAD nor workdir) is given as empty. */ if (dup->status == GIT_DELTA_DELETED) { - if (a->status == GIT_DELTA_ADDED) + if (a->status == GIT_DELTA_ADDED) { dup->status = GIT_DELTA_UNMODIFIED; + dup->nfiles = 2; + } /* else don't overwrite DELETE status */ } else { dup->status = a->status; + dup->nfiles = a->nfiles; } git_oid_cpy(&dup->old_file.id, &a->old_file.id); @@ -118,10 +121,13 @@ static git_diff_delta *diff_delta__merge_like_cgit_reversed( return dup; if (dup->status == GIT_DELTA_DELETED) { - if (b->status == GIT_DELTA_ADDED) + if (b->status == GIT_DELTA_ADDED) { dup->status = GIT_DELTA_UNMODIFIED; + dup->nfiles = 2; + } } else { dup->status = b->status; + dup->nfiles = b->nfiles; } git_oid_cpy(&dup->old_file.id, &b->old_file.id); |