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>
Elijah Newren committed
Sep 27, 2021 at 16:33 UTC
56d06fe4aa9089bccb4ff247fc3224fc7431c72d
2 files changed
+4
-1
t/t2500-untracked-overwriting.sh
+1
-1
@@ -218,7 +218,7 @@ test_expect_success 'git am --abort and untracked dir vs. unmerged file' '
218
)
219
'
220
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' '
222
test_setup_sequencing am_skip_and_untracked &&
223
(
224
cd sequencing_am_skip_and_untracked &&
unpack-trees.c
+3
@@ -2409,7 +2409,10 @@ static int deleted_entry(const struct cache_entry *ce,
2409
if (verify_absent(ce, ERROR_WOULD_LOSE_UNTRACKED_REMOVED, o))
2410
return -1;
2411
return 0;
2412
+ } else if (verify_absent_if_directory(ce, ERROR_WOULD_LOSE_UNTRACKED_REMOVED, o)) {
2413
+ return -1;
2414
}
2415
+
2416
if (!(old->ce_flags & CE_CONFLICTED) && verify_uptodate(old, o))
2417
return -1;
2418
add_entry(o, ce, CE_REMOVE, 0);