summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 7a4e6f20fa..36948eafb7 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -958,7 +958,7 @@ static int update_file_flags(struct merge_options *opt,
if (S_ISREG(contents->mode)) {
struct strbuf strbuf = STRBUF_INIT;
if (convert_to_working_tree(opt->repo->index,
- path, buf, size, &strbuf)) {
+ path, buf, size, &strbuf, NULL)) {
free(buf);
size = strbuf.len;
buf = strbuf_detach(&strbuf, NULL);
@@ -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;