diff options
| author | Jeff King <peff@peff.net> | 2020-12-03 03:09:42 -0500 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2020-12-03 10:25:13 -0800 |
| commit | d43a21bdbbaf0bc286df8d8e2e29a3e9caa448e8 (patch) | |
| tree | c042749d6a3ee007d0ac8655f65912ead9f1a395 | |
| parent | Git 2.29.2 (diff) | |
| download | git-d43a21bdbbaf0bc286df8d8e2e29a3e9caa448e8.tar.gz git-d43a21bdbbaf0bc286df8d8e2e29a3e9caa448e8.zip | |
upload-pack: propagate return value from object filter config callback
If we encounter an error in parse_filter_object_config(), we'll complain
to stderr but won't actually propagate the return value up the stack.
This is unlike most of our config callbacks, which return the error to
git_config() so it can die (this includes the call just below us to
parse_hide_refs_config(), which can also produce errors).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
| -rwxr-xr-x | t/t5616-partial-clone.sh | 8 | ||||
| -rw-r--r-- | upload-pack.c | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh index f4d49d8335..2ea66205cf 100755 --- a/t/t5616-partial-clone.sh +++ b/t/t5616-partial-clone.sh @@ -251,6 +251,14 @@ test_expect_success 'implicitly construct combine: filter with repeated flags' ' test_cmp unique_types.expected unique_types.actual ' +test_expect_success 'upload-pack complains of bogus filter config' ' + printf 0000 | + test_must_fail git \ + -c uploadpackfilter.tree.maxdepth \ + upload-pack . >/dev/null 2>err && + test_i18ngrep "unable to parse.*tree.maxdepth" err +' + test_expect_success 'upload-pack fails banned object filters' ' test_config -C srv.bare uploadpackfilter.blob:none.allow false && test_must_fail ok=sigpipe git clone --no-checkout --filter=blob:none \ diff --git a/upload-pack.c b/upload-pack.c index 3b858eb457..1dd8afbbcb 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -1307,7 +1307,8 @@ static int upload_pack_config(const char *var, const char *value, void *cb_data) return git_config_string(&data->pack_objects_hook, var, value); } - parse_object_filter_config(var, value, data); + if (parse_object_filter_config(var, value, data) < 0) + return -1; return parse_hide_refs_config(var, value, "uploadpack"); } |
