diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-05-30 07:04:10 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-30 07:04:10 +0200 |
commit | 54db5c0e1edf0d92bd474f515fab349b98c18a24 (patch) | |
tree | 9da6fa1473068ed9e5f9361911bfe697ae7f94eb /upload-pack.c | |
parent | Merge branch 'bc/object-id' (diff) | |
parent | {fetch,upload}-pack: support filter in protocol v2 (diff) | |
download | git-54db5c0e1edf0d92bd474f515fab349b98c18a24.tar.xz git-54db5c0e1edf0d92bd474f515fab349b98c18a24.zip |
Merge branch 'jt/partial-clone-proto-v2'
Transfer protocol v2 learned to support the partial clone.
* jt/partial-clone-proto-v2:
{fetch,upload}-pack: support filter in protocol v2
upload-pack: read config when serving protocol v2
upload-pack: fix error message typo
Diffstat (limited to 'upload-pack.c')
-rw-r--r-- | upload-pack.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/upload-pack.c b/upload-pack.c index bacc92bbb6..87c6722ea5 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -1205,6 +1205,7 @@ static void process_args(struct packet_reader *request, { while (packet_reader_read(request) != PACKET_READ_FLUSH) { const char *arg = request->line; + const char *p; /* process want */ if (parse_want(arg)) @@ -1251,8 +1252,13 @@ static void process_args(struct packet_reader *request, continue; } + if (allow_filter && skip_prefix(arg, "filter ", &p)) { + parse_list_objects_filter(&filter_options, p); + continue; + } + /* ignore unknown lines maybe? */ - die("unexpect line: '%s'", arg); + die("unexpected line: '%s'", arg); } } @@ -1376,6 +1382,8 @@ int upload_pack_v2(struct repository *r, struct argv_array *keys, enum fetch_state state = FETCH_PROCESS_ARGS; struct upload_pack_data data; + git_config(upload_pack_config, NULL); + upload_pack_data_init(&data); use_sideband = LARGE_PACKET_MAX; @@ -1428,7 +1436,14 @@ int upload_pack_v2(struct repository *r, struct argv_array *keys, int upload_pack_advertise(struct repository *r, struct strbuf *value) { - if (value) + if (value) { + int allow_filter_value; strbuf_addstr(value, "shallow"); + if (!repo_config_get_bool(the_repository, + "uploadpack.allowfilter", + &allow_filter_value) && + allow_filter_value) + strbuf_addstr(value, " filter"); + } return 1; } |