diff options
-rw-r--r-- | read-cache.c | 13 | ||||
-rwxr-xr-x | t/t1015-read-index-unmerged.sh | 8 | ||||
-rwxr-xr-x | t/t6020-merge-df.sh | 3 | ||||
-rwxr-xr-x | t/t6042-merge-rename-corner-cases.sh | 2 |
4 files changed, 12 insertions, 14 deletions
diff --git a/read-cache.c b/read-cache.c index 372588260e..666d295a5a 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2632,10 +2632,13 @@ out: /* * Read the index file that is potentially unmerged into given - * index_state, dropping any unmerged entries. Returns true if - * the index is unmerged. Callers who want to refuse to work - * from an unmerged state can call this and check its return value, - * instead of calling read_cache(). + * index_state, dropping any unmerged entries to stage #0 (potentially + * resulting in a path appearing as both a file and a directory in the + * index; the caller is responsible to clear out the extra entries + * before writing the index to a tree). Returns true if the index is + * unmerged. Callers who want to refuse to work from an unmerged + * state can call this and check its return value, instead of calling + * read_cache(). */ int read_index_unmerged(struct index_state *istate) { @@ -2658,7 +2661,7 @@ int read_index_unmerged(struct index_state *istate) new_ce->ce_flags = create_ce_flags(0) | CE_CONFLICTED; new_ce->ce_namelen = len; new_ce->ce_mode = ce->ce_mode; - if (add_index_entry(istate, new_ce, 0)) + if (add_index_entry(istate, new_ce, ADD_CACHE_SKIP_DFCHECK)) return error("%s: cannot drop to stage #0", new_ce->name); } diff --git a/t/t1015-read-index-unmerged.sh b/t/t1015-read-index-unmerged.sh index 32ef6bdcfa..55d22da32c 100755 --- a/t/t1015-read-index-unmerged.sh +++ b/t/t1015-read-index-unmerged.sh @@ -30,7 +30,7 @@ test_expect_success 'setup modify/delete + directory/file conflict' ' ) ' -test_expect_failure 'read-tree --reset cleans unmerged entries' ' +test_expect_success 'read-tree --reset cleans unmerged entries' ' test_when_finished "git -C df_plus_modify_delete clean -f" && test_when_finished "git -C df_plus_modify_delete reset --hard" && ( @@ -45,7 +45,7 @@ test_expect_failure 'read-tree --reset cleans unmerged entries' ' ) ' -test_expect_failure 'One reset --hard cleans unmerged entries' ' +test_expect_success 'One reset --hard cleans unmerged entries' ' test_when_finished "git -C df_plus_modify_delete clean -f" && test_when_finished "git -C df_plus_modify_delete reset --hard" && ( @@ -87,7 +87,7 @@ test_expect_success 'setup directory/file conflict + simple edit/edit' ' ) ' -test_expect_failure 'git merge --abort succeeds despite D/F conflict' ' +test_expect_success 'git merge --abort succeeds despite D/F conflict' ' test_when_finished "git -C df_plus_edit_edit clean -f" && test_when_finished "git -C df_plus_edit_edit reset --hard" && ( @@ -103,7 +103,7 @@ test_expect_failure 'git merge --abort succeeds despite D/F conflict' ' ) ' -test_expect_failure 'git am --skip succeeds despite D/F conflict' ' +test_expect_success 'git am --skip succeeds despite D/F conflict' ' test_when_finished "git -C df_plus_edit_edit clean -f" && test_when_finished "git -C df_plus_edit_edit reset --hard" && ( diff --git a/t/t6020-merge-df.sh b/t/t6020-merge-df.sh index 2af1beec5f..46b506b3b7 100755 --- a/t/t6020-merge-df.sh +++ b/t/t6020-merge-df.sh @@ -89,9 +89,6 @@ test_expect_success 'modify/delete + directory/file conflict' ' ' test_expect_success 'modify/delete + directory/file conflict; other way' ' - # Yes, we really need the double reset since "letters" appears as - # both a file and a directory. - git reset --hard && git reset --hard && git clean -f && git checkout modify^0 && diff --git a/t/t6042-merge-rename-corner-cases.sh b/t/t6042-merge-rename-corner-cases.sh index 411550d2b6..de77bfaf4f 100755 --- a/t/t6042-merge-rename-corner-cases.sh +++ b/t/t6042-merge-rename-corner-cases.sh @@ -236,7 +236,6 @@ test_expect_success 'setup content merge + rename/directory conflict' ' test_expect_success 'rename/directory conflict + clean content merge' ' git reset --hard && - git reset --hard && git clean -fdqx && git checkout left-clean^0 && @@ -260,7 +259,6 @@ test_expect_success 'rename/directory conflict + clean content merge' ' test_expect_success 'rename/directory conflict + content merge conflict' ' git reset --hard && - git reset --hard && git clean -fdqx && git checkout left-conflict^0 && |