summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xt/t1091-sparse-checkout-builtin.sh12
-rw-r--r--unpack-trees.c2
2 files changed, 13 insertions, 1 deletions
diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh
index 37e9304ef3..7d982096fb 100755
--- a/t/t1091-sparse-checkout-builtin.sh
+++ b/t/t1091-sparse-checkout-builtin.sh
@@ -305,6 +305,18 @@ test_expect_success 'different sparse-checkouts with worktrees' '
check_files worktree a deep
'
+test_expect_success 'set using filename keeps file on-disk' '
+ git -C repo sparse-checkout set a deep &&
+ cat >expect <<-\EOF &&
+ /*
+ !/*/
+ /a/
+ /deep/
+ EOF
+ test_cmp expect repo/.git/info/sparse-checkout &&
+ check_files repo a deep
+'
+
check_read_tree_errors () {
REPO=$1
FILES=$2
diff --git a/unpack-trees.c b/unpack-trees.c
index 3789a22cf0..78425ce74b 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1416,7 +1416,7 @@ static int clear_ce_flags_1(struct index_state *istate,
name, &dtype, pl, istate);
if (ret == UNDECIDED)
ret = default_match;
- if (ret == MATCHED)
+ if (ret == MATCHED || ret == MATCHED_RECURSIVE)
ce->ce_flags &= ~clear_mask;
cache++;
progress_nr++;