summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-11-05 12:18:11 -0800
committerJunio C Hamano <gitster@pobox.com>2015-11-05 12:18:11 -0800
commit5e6154fb145d66af36e10ef4db7e1d1e9502c501 (patch)
tree98e62ba6a698d6a4ed266b98e9a95bc5fe1b1c1a /merge-recursive.c
parentc378862b1ec23dd526e318b4c1bfbf826f8dd6b6 (diff)
parent72fac66bca302dbecbe42dfa0ddc7e42db2fe567 (diff)
downloadgit-5e6154fb145d66af36e10ef4db7e1d1e9502c501.tar.gz
Merge branch 'jk/delete-modechange-conflict' into maint
Merging a branch that removes a path and another that changes the mode bits on the same path should have conflicted at the path, but it didn't and silently favoured the removal. * jk/delete-modechange-conflict: merge: detect delete/modechange conflict t6031: generalize for recursive and resolve strategies t6031: move triple-rename test to t3030
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 44d85bea4b..b446df9c1d 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1531,13 +1531,17 @@ static int read_sha1_strbuf(const unsigned char *sha1, struct strbuf *dst)
}
static int blob_unchanged(const unsigned char *o_sha,
+ unsigned o_mode,
const unsigned char *a_sha,
+ unsigned a_mode,
int renormalize, const char *path)
{
struct strbuf o = STRBUF_INIT;
struct strbuf a = STRBUF_INIT;
int ret = 0; /* assume changed for safety */
+ if (a_mode != o_mode)
+ return 0;
if (sha_eq(o_sha, a_sha))
return 1;
if (!renormalize)
@@ -1723,8 +1727,8 @@ static int process_entry(struct merge_options *o,
} else if (o_sha && (!a_sha || !b_sha)) {
/* Case A: Deleted in one */
if ((!a_sha && !b_sha) ||
- (!b_sha && blob_unchanged(o_sha, a_sha, normalize, path)) ||
- (!a_sha && blob_unchanged(o_sha, b_sha, normalize, path))) {
+ (!b_sha && blob_unchanged(o_sha, o_mode, a_sha, a_mode, normalize, path)) ||
+ (!a_sha && blob_unchanged(o_sha, o_mode, b_sha, b_mode, normalize, path))) {
/* Deleted in both or deleted in one and
* unchanged in the other */
if (a_sha)