]> git.ipfire.org Git - thirdparty/git.git/commitdiff
upload-pack: propagate return value from object filter config callback
authorJeff King <peff@peff.net>
Thu, 3 Dec 2020 08:09:42 +0000 (03:09 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 3 Dec 2020 18:25:13 +0000 (10:25 -0800)
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>
t/t5616-partial-clone.sh
upload-pack.c

index f4d49d833577c33f741adfb8e5ded0cdae2a4a8b..2ea66205cf2170c8fd30c0cd91c2f2d59e6d1989 100755 (executable)
@@ -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 \
index 3b858eb457e557592dada080f95f3fe7e218b24b..1dd8afbbcb4548c417cd9e80c8124cddd86e895b 100644 (file)
@@ -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");
 }