summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xt/t1011-read-tree-sparse-checkout.sh2
-rw-r--r--unpack-trees.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh
index 85e08374dd..9a07de1a5b 100755
--- a/t/t1011-read-tree-sparse-checkout.sh
+++ b/t/t1011-read-tree-sparse-checkout.sh
@@ -146,7 +146,7 @@ test_expect_success 'read-tree adds to worktree, absent case' '
test ! -f sub/added
'
-test_expect_failure 'read-tree adds to worktree, dirty case' '
+test_expect_success 'read-tree adds to worktree, dirty case' '
echo init.t >.git/info/sparse-checkout &&
git checkout -f removed &&
mkdir sub &&
diff --git a/unpack-trees.c b/unpack-trees.c
index 7c9b0466c9..8b16215322 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1096,6 +1096,8 @@ static int merged_entry(struct cache_entry *merge, struct cache_entry *old,
if (!old) {
if (verify_absent(merge, "overwritten", o))
return -1;
+ if (!o->skip_sparse_checkout && will_have_skip_worktree(merge, o))
+ update |= CE_SKIP_WORKTREE;
invalidate_ce_path(merge, o);
} else if (!(old->ce_flags & CE_CONFLICTED)) {
/*