summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorJosh Steadmon <steadmon@google.com>2019-01-08 00:17:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-15 23:42:31 (GMT)
commit87c2d9d3102e6c388f2d29f1bdb0b3a222d9a707 (patch)
treebfc01fed555a7f00b7ad226bed3ffafd0d70f2c0 /upload-pack.c
parent8272f26034c9dbaf5cd216a137b8e91241cbc24e (diff)
downloadgit-87c2d9d3102e6c388f2d29f1bdb0b3a222d9a707.zip
git-87c2d9d3102e6c388f2d29f1bdb0b3a222d9a707.tar.gz
git-87c2d9d3102e6c388f2d29f1bdb0b3a222d9a707.tar.bz2
filter-options: expand scaled numbers
When communicating with a remote server or a subprocess, use expanded numbers rather than numbers with scaling suffix in the object filter spec (e.g. "limit:blob=1k" becomes "limit:blob=1024"). Update the protocol docs to note that clients should always perform this expansion, to allow for more compatibility between server implementations. Signed-off-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 5e81f1f..1c6d73e 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -140,14 +140,17 @@ static void create_pack_file(const struct object_array *have_obj,
if (use_include_tag)
argv_array_push(&pack_objects.args, "--include-tag");
if (filter_options.filter_spec) {
+ struct strbuf expanded_filter_spec = STRBUF_INIT;
+ expand_list_objects_filter_spec(&filter_options,
+ &expanded_filter_spec);
if (pack_objects.use_shell) {
struct strbuf buf = STRBUF_INIT;
- sq_quote_buf(&buf, filter_options.filter_spec);
+ sq_quote_buf(&buf, expanded_filter_spec.buf);
argv_array_pushf(&pack_objects.args, "--filter=%s", buf.buf);
strbuf_release(&buf);
} else {
argv_array_pushf(&pack_objects.args, "--filter=%s",
- filter_options.filter_spec);
+ expanded_filter_spec.buf);
}
}