unpack-trees: avoid nuking untracked dir in way of locally deleted file

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren 2021-09-27 16:33:46 +00:00 committed by Junio C Hamano
parent 1fdd51aa13
commit 56d06fe4aa
2 changed files with 4 additions and 1 deletions

View File

@ -218,7 +218,7 @@ test_expect_success 'git am --abort and untracked dir vs. unmerged file' '
) )
' '
test_expect_failure 'git am --skip and untracked dir vs deleted file' ' test_expect_success 'git am --skip and untracked dir vs deleted file' '
test_setup_sequencing am_skip_and_untracked && test_setup_sequencing am_skip_and_untracked &&
( (
cd sequencing_am_skip_and_untracked && cd sequencing_am_skip_and_untracked &&

View File

@ -2409,7 +2409,10 @@ static int deleted_entry(const struct cache_entry *ce,
if (verify_absent(ce, ERROR_WOULD_LOSE_UNTRACKED_REMOVED, o)) if (verify_absent(ce, ERROR_WOULD_LOSE_UNTRACKED_REMOVED, o))
return -1; return -1;
return 0; return 0;
} else if (verify_absent_if_directory(ce, ERROR_WOULD_LOSE_UNTRACKED_REMOVED, o)) {
return -1;
} }
if (!(old->ce_flags & CE_CONFLICTED) && verify_uptodate(old, o)) if (!(old->ce_flags & CE_CONFLICTED) && verify_uptodate(old, o))
return -1; return -1;
add_entry(o, ce, CE_REMOVE, 0); add_entry(o, ce, CE_REMOVE, 0);