summaryrefslogtreecommitdiff
path: root/builtin/fetch.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 /builtin/fetch.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 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index e014032..8b8bb64 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1172,6 +1172,7 @@ static void add_negotiation_tips(struct git_transport_options *smart_options)
static struct transport *prepare_transport(struct remote *remote, int deepen)
{
struct transport *transport;
+
transport = transport_get(remote, NULL);
transport_set_verbosity(transport, verbosity, progress);
transport->family = family;
@@ -1191,9 +1192,13 @@ static struct transport *prepare_transport(struct remote *remote, int deepen)
if (update_shallow)
set_option(transport, TRANS_OPT_UPDATE_SHALLOW, "yes");
if (filter_options.choice) {
+ struct strbuf expanded_filter_spec = STRBUF_INIT;
+ expand_list_objects_filter_spec(&filter_options,
+ &expanded_filter_spec);
set_option(transport, TRANS_OPT_LIST_OBJECTS_FILTER,
- filter_options.filter_spec);
+ expanded_filter_spec.buf);
set_option(transport, TRANS_OPT_FROM_PROMISOR, "1");
+ strbuf_release(&expanded_filter_spec);
}
if (negotiation_tip.nr) {
if (transport->smart_options)