mirror of
https://git.proxmox.com/git/libgit2
synced 2025-07-09 19:21:51 +00:00
Merge pull request #3024 from git-up/diff_merge_fix
Make sure to also update delta->nfiles when merging diffs
This commit is contained in:
commit
08c45213b1
@ -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.
|
* index (i.e. not in HEAD nor workdir) is given as empty.
|
||||||
*/
|
*/
|
||||||
if (dup->status == GIT_DELTA_DELETED) {
|
if (dup->status == GIT_DELTA_DELETED) {
|
||||||
if (a->status == GIT_DELTA_ADDED)
|
if (a->status == GIT_DELTA_ADDED) {
|
||||||
dup->status = GIT_DELTA_UNMODIFIED;
|
dup->status = GIT_DELTA_UNMODIFIED;
|
||||||
|
dup->nfiles = 2;
|
||||||
|
}
|
||||||
/* else don't overwrite DELETE status */
|
/* else don't overwrite DELETE status */
|
||||||
} else {
|
} else {
|
||||||
dup->status = a->status;
|
dup->status = a->status;
|
||||||
|
dup->nfiles = a->nfiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_oid_cpy(&dup->old_file.id, &a->old_file.id);
|
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;
|
return dup;
|
||||||
|
|
||||||
if (dup->status == GIT_DELTA_DELETED) {
|
if (dup->status == GIT_DELTA_DELETED) {
|
||||||
if (b->status == GIT_DELTA_ADDED)
|
if (b->status == GIT_DELTA_ADDED) {
|
||||||
dup->status = GIT_DELTA_UNMODIFIED;
|
dup->status = GIT_DELTA_UNMODIFIED;
|
||||||
|
dup->nfiles = 2;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dup->status = b->status;
|
dup->status = b->status;
|
||||||
|
dup->nfiles = b->nfiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_oid_cpy(&dup->old_file.id, &b->old_file.id);
|
git_oid_cpy(&dup->old_file.id, &b->old_file.id);
|
||||||
|
Loading…
Reference in New Issue
Block a user