summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-02-20 22:49:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-20 22:49:17 (GMT)
commit738f14732b85c1988da1e7ded13f7ec453ecb3f8 (patch)
tree39a659f911b8a0eca54fd7474be987cfba405c30
parenta92f01202f300014930a59fe10fbb212f41b8601 (diff)
parent6c11c6a124a0175f4d1b94f0fa077ed1c098339b (diff)
downloadgit-738f14732b85c1988da1e7ded13f7ec453ecb3f8.zip
git-738f14732b85c1988da1e7ded13f7ec453ecb3f8.tar.gz
git-738f14732b85c1988da1e7ded13f7ec453ecb3f8.tar.bz2
Merge branch 'ds/sparse-add' into jch
* ds/sparse-add: sparse-checkout: allow one-character directories in cone mode
-rw-r--r--dir.c2
-rwxr-xr-xt/t1091-sparse-checkout-builtin.sh12
2 files changed, 12 insertions, 2 deletions
diff --git a/dir.c b/dir.c
index 0dc0f11..0ffb1b3 100644
--- a/dir.c
+++ b/dir.c
@@ -688,7 +688,7 @@ static void add_pattern_to_hashsets(struct pattern_list *pl, struct path_pattern
return;
}
- if (given->patternlen <= 2 ||
+ if (given->patternlen < 2 ||
*given->pattern == '*' ||
strstr(given->pattern, "**")) {
/* Not a cone pattern. */
diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh
index c35cbde..b4c9c32 100755
--- a/t/t1091-sparse-checkout-builtin.sh
+++ b/t/t1091-sparse-checkout-builtin.sh
@@ -417,10 +417,20 @@ test_expect_success 'pattern-checks: too short' '
cat >repo/.git/info/sparse-checkout <<-\EOF &&
/*
!/*/
- /a
+ /
EOF
check_read_tree_errors repo "a" "disabling cone pattern matching"
'
+test_expect_success 'pattern-checks: not too short' '
+ cat >repo/.git/info/sparse-checkout <<-\EOF &&
+ /*
+ !/*/
+ /b/
+ EOF
+ git -C repo read-tree -mu HEAD 2>err &&
+ test_must_be_empty err &&
+ check_files repo a
+'
test_expect_success 'pattern-checks: trailing "*"' '
cat >repo/.git/info/sparse-checkout <<-\EOF &&