summaryrefslogtreecommitdiff
path: root/t/t5616-partial-clone.sh
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2020-08-03 18:00:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-08-04 01:03:46 (GMT)
commit5b01a4e8ff19fa9797a67b53df2db0a1a574fe81 (patch)
tree611f65243e8bec6abe5c6192fb25f35e888bf95a /t/t5616-partial-clone.sh
parent6dd3456a8ccbad6a0a6a31bc7192025617114243 (diff)
downloadgit-5b01a4e8ff19fa9797a67b53df2db0a1a574fe81.zip
git-5b01a4e8ff19fa9797a67b53df2db0a1a574fe81.tar.gz
git-5b01a4e8ff19fa9797a67b53df2db0a1a574fe81.tar.bz2
upload-pack.c: introduce 'uploadpackfilter.tree.maxDepth'
In b79cf959b2 (upload-pack.c: allow banning certain object filter(s), 2020-02-26), we introduced functionality to disallow certain object filters from being chosen from within 'git upload-pack'. Traditionally, administrators use this functionality to disallow filters that are known to perform slowly, for e.g., those that do not have bitmap-level filtering. In the past, the '--filter=tree:<n>' was one such filter that does not have bitmap-level filtering support, and so was likely to be banned by administrators. However, in the previous couple of commits, we introduced bitmap-level filtering for the case when 'n' is equal to '0', i.e., as if we had a '--filter=tree:none' choice. While it would be sufficient to simply write $ git config uploadpackfilter.tree.allow true (since it would allow all values of 'n'), we would like to be able to allow this filter for certain values of 'n', i.e., those no greater than some pre-specified maximum. In order to do this, introduce a new configuration key, as follows: $ git config uploadpackfilter.tree.maxDepth <m> where '<m>' specifies the maximum allowed value of 'n' in the filter 'tree:n'. Administrators who wish to allow for only the value '0' can write: $ git config uploadpackfilter.tree.allow true $ git config uploadpackfilter.tree.maxDepth 0 which allows '--filter=tree:0', but no other values. Signed-off-by: Taylor Blau <me@ttaylorr.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5616-partial-clone.sh')
-rwxr-xr-xt/t5616-partial-clone.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index 1fff4ff..4247102 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -259,6 +259,15 @@ test_expect_success 'upload-pack fails banned object filters with fallback' '
grep "filter '\''blob:none'\'' not supported" err
'
+test_expect_success 'upload-pack limits tree depth filters' '
+ test_config -C srv.bare uploadpackfilter.allow false &&
+ test_config -C srv.bare uploadpackfilter.tree.allow true &&
+ test_config -C srv.bare uploadpackfilter.tree.maxDepth 0 &&
+ test_must_fail ok=sigpipe git clone --no-checkout --filter=tree:1 \
+ "file://$(pwd)/srv.bare" pc3 2>err &&
+ grep "tree filter allows max depth 0, but got 1" err
+'
+
test_expect_success 'partial clone fetches blobs pointed to by refs even if normally filtered out' '
rm -rf src dst &&
git init src &&