@@ -71,7 +71,7 @@ char *find_pathspecs_matching_skip_worktree(const struct pathspec *pathspec)
for (i = 0; i < istate->cache_nr; i++) {
struct cache_entry *ce = istate->cache[i];
- if (ce_skip_worktree(ce))
+ if (ce_skip_worktree(ce) || !path_in_sparse_checkout(ce->name, istate))
ce_path_match(istate, ce, pathspec, seen);
}
@@ -406,7 +406,7 @@ test_expect_success 'sparse-checkout (init|set|disable) warns with unmerged stat
git -C unmerged sparse-checkout disable
'
-test_expect_success 'sparse-checkout reapply' '
+test_expect_failure 'sparse-checkout reapply' '
git clone repo tweak &&
echo dirty >tweak/deep/deeper2/a &&
@@ -438,6 +438,8 @@ test_expect_success 'sparse-checkout reapply' '
test_i18ngrep "warning.*The following paths are unmerged" err &&
test_path_is_file tweak/folder1/a &&
+ # NEEDSWORK: We are asking to update a file outside of the
+ # sparse-checkout cone, but this is no longer allowed.
git -C tweak add folder1/a &&
git -C tweak sparse-checkout reapply 2>err &&
test_must_be_empty err &&
@@ -518,9 +518,8 @@ test_expect_success 'merge with conflict outside cone' '
test_all_match git status --porcelain=v2 &&
# 2. Add the file with conflict markers
- # NEEDSWORK: Even though the merge conflict removed the
- # SKIP_WORKTREE bit from the index entry for folder1/a, we should
- # warn that this is a problematic add when --sparse is not set.
+ test_sparse_match test_must_fail git add folder1/a &&
+ test_i18ngrep "Disable or modify the sparsity rules" sparse-checkout-err &&
test_all_match git add --sparse folder1/a &&
test_all_match git status --porcelain=v2 &&
@@ -528,6 +527,7 @@ test_expect_success 'merge with conflict outside cone' '
# accept conflict markers as resolved content.
run_on_all mv folder2/a folder2/z &&
test_sparse_match test_must_fail git add folder2 &&
+ test_i18ngrep "Disable or modify the sparsity rules" sparse-checkout-err &&
test_all_match git add --sparse folder2 &&
test_all_match git status --porcelain=v2 &&