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
This commit is contained in:
Junio C Hamano
2015-10-30 13:06:56 -07:00
5 changed files with 144 additions and 89 deletions

View File

@ -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)