summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-12-14 10:21:37 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-12-14 10:21:37 -0800
commita5e74b4baaf17ea069fa451c405ef219eb61ee7a (patch)
treeb4fddbe693872c11d1515463e0c37e77d4522843
parentMerge branch 'ae/doc-reproducible-html' (diff)
parentupload-pack: propagate return value from object filter config callback (diff)
downloadtgif-a5e74b4baaf17ea069fa451c405ef219eb61ee7a.tar.xz
Merge branch 'jk/check-config-parsing-error-in-upload-pack'
Tighten error checking in the codepath that responds to "git fetch". * jk/check-config-parsing-error-in-upload-pack: upload-pack: propagate return value from object filter config callback
-rwxr-xr-xt/t5616-partial-clone.sh8
-rw-r--r--upload-pack.c3
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 8abb7de5d7..a856de1ce0 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -1329,7 +1329,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");
}