summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-10-30 13:06:56 -0700
committerJunio C Hamano <gitster@pobox.com>2015-10-30 13:06:57 -0700
commit203501b39fe89193c252ec651d4bf1fafd784b30 (patch)
tree66fd8be35b5b3b78365a5673c69d9f710fa259ab /merge-recursive.c
parentf7722a447ab6121f0567cb7f211093983c300a97 (diff)
parent72fac66bca302dbecbe42dfa0ddc7e42db2fe567 (diff)
downloadgit-203501b39fe89193c252ec651d4bf1fafd784b30.tar.gz
Merge branch 'jk/delete-modechange-conflict'
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 a5e74d85fd..21e680a78e 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1530,13 +1530,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)
@@ -1722,8 +1726,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)