Skip to content

Commit 56d06fe

Browse files
newrengitster
authored andcommitted
unpack-trees: avoid nuking untracked dir in way of locally deleted file
Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1fdd51a commit 56d06fe

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

t/t2500-untracked-overwriting.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ test_expect_success 'git am --abort and untracked dir vs. unmerged file' '
218218
)
219219
'
220220

221-
test_expect_failure 'git am --skip and untracked dir vs deleted file' '
221+
test_expect_success 'git am --skip and untracked dir vs deleted file' '
222222
test_setup_sequencing am_skip_and_untracked &&
223223
(
224224
cd sequencing_am_skip_and_untracked &&

unpack-trees.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2409,7 +2409,10 @@ static int deleted_entry(const struct cache_entry *ce,
24092409
if (verify_absent(ce, ERROR_WOULD_LOSE_UNTRACKED_REMOVED, o))
24102410
return -1;
24112411
return 0;
2412+
} else if (verify_absent_if_directory(ce, ERROR_WOULD_LOSE_UNTRACKED_REMOVED, o)) {
2413+
return -1;
24122414
}
2415+
24132416
if (!(old->ce_flags & CE_CONFLICTED) && verify_uptodate(old, o))
24142417
return -1;
24152418
add_entry(o, ce, CE_REMOVE, 0);

0 commit comments

Comments
 (0)