diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-05-20 08:33:27 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-05-20 08:33:27 -0700 |
commit | abbd1d9ebf9033924153c7a0f0abb37e7c8e50fd (patch) | |
tree | caea3081d1e04556c08f69522d15f2b478a12be1 /merge-recursive.c | |
parent | Merge branch 'cb/no-more-gmtime' (diff) | |
parent | merge-recursive: fix rename/rename(1to2) for working tree with a binary (diff) | |
download | tgif-abbd1d9ebf9033924153c7a0f0abb37e7c8e50fd.tar.xz |
Merge branch 'en/merge-rename-rename-worktree-fix'
When a binary file gets modified and renamed on both sides of history
to different locations, both files would be written to the working
tree but both would have the contents from "ours". This has been
corrected so that the path from each side gets their original content.
* en/merge-rename-rename-worktree-fix:
merge-recursive: fix rename/rename(1to2) for working tree with a binary
Diffstat (limited to 'merge-recursive.c')
-rw-r--r-- | merge-recursive.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index d92e2acf1e..36948eafb7 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1750,6 +1750,18 @@ static int handle_rename_rename_1to2(struct merge_options *opt, return -1; } + if (!mfi.clean && mfi.blob.mode == a->mode && + oideq(&mfi.blob.oid, &a->oid)) { + /* + * Getting here means we were attempting to merge a binary + * blob. Since we can't merge binaries, the merge algorithm + * just takes one side. But we don't want to copy the + * contents of one side to both paths; we'd rather use the + * original content at the given path for each path. + */ + oidcpy(&mfi.blob.oid, &b->oid); + mfi.blob.mode = b->mode; + } add = &ci->ren2->dst_entry->stages[flip_stage(3)]; if (is_valid(add)) { add->path = mfi.blob.path = b->path; |