Merge branch 'jv/upload-pack-filter-spec-quotefix'

Fix in passing custom args from "git clone" to "upload-pack" on the
other side.

* jv/upload-pack-filter-spec-quotefix:
  t5544: clarify 'hook works with partial clone' test
  upload-pack.c: fix filter spec quoting bug
This commit is contained in:
Junio C Hamano 2021-02-12 14:21:04 -08:00
commit 60f8121940
2 changed files with 11 additions and 8 deletions

View File

@ -59,4 +59,14 @@ test_expect_success 'hook does not run from repo config' '
test_path_is_missing .git/hook.stdout test_path_is_missing .git/hook.stdout
' '
test_expect_success 'hook works with partial clone' '
clear_hook_results &&
test_config_global uploadpack.packObjectsHook ./hook &&
test_config_global uploadpack.allowFilter true &&
git clone --bare --no-local --filter=blob:none . dst.git &&
git -C dst.git rev-list --objects --missing=allow-any --no-object-names --all >objects &&
git -C dst.git cat-file --batch-check="%(objecttype)" <objects >types &&
! grep blob types
'
test_done test_done

View File

@ -305,15 +305,8 @@ static void create_pack_file(struct upload_pack_data *pack_data,
if (pack_data->filter_options.choice) { if (pack_data->filter_options.choice) {
const char *spec = const char *spec =
expand_list_objects_filter_spec(&pack_data->filter_options); expand_list_objects_filter_spec(&pack_data->filter_options);
if (pack_objects.use_shell) {
struct strbuf buf = STRBUF_INIT;
sq_quote_buf(&buf, spec);
strvec_pushf(&pack_objects.args, "--filter=%s", buf.buf);
strbuf_release(&buf);
} else {
strvec_pushf(&pack_objects.args, "--filter=%s", spec); strvec_pushf(&pack_objects.args, "--filter=%s", spec);
} }
}
if (uri_protocols) { if (uri_protocols) {
for (i = 0; i < uri_protocols->nr; i++) for (i = 0; i < uri_protocols->nr; i++)
strvec_pushf(&pack_objects.args, "--uri-protocol=%s", strvec_pushf(&pack_objects.args, "--uri-protocol=%s",