From: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> --- upload-pack.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/upload-pack.c b/upload-pack.c index dc802a0..aaaf883 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -535,6 +535,28 @@ error: } } +static void parse_features(const char *features) +{ + if (parse_feature_request(features, "multi_ack_detailed")) + multi_ack = 2; + else if (parse_feature_request(features, "multi_ack")) + multi_ack = 1; + if (parse_feature_request(features, "no-done")) + no_done = 1; + if (parse_feature_request(features, "thin-pack")) + use_thin_pack = 1; + if (parse_feature_request(features, "ofs-delta")) + use_ofs_delta = 1; + if (parse_feature_request(features, "side-band-64k")) + use_sideband = LARGE_PACKET_MAX; + else if (parse_feature_request(features, "side-band")) + use_sideband = DEFAULT_PACKET_MAX; + if (parse_feature_request(features, "no-progress")) + no_progress = 1; + if (parse_feature_request(features, "include-tag")) + use_include_tag = 1; +} + static void receive_needs(void) { struct object_array shallows = OBJECT_ARRAY_INIT; @@ -544,7 +566,6 @@ static void receive_needs(void) shallow_nr = 0; for (;;) { struct object *o; - const char *features; unsigned char sha1_buf[20]; char *line = packet_read_line(0, NULL); reset_timeout(); @@ -579,26 +600,7 @@ static void receive_needs(void) die("git upload-pack: protocol error, " "expected to get sha, not '%s'", line); - features = line + 45; - - if (parse_feature_request(features, "multi_ack_detailed")) - multi_ack = 2; - else if (parse_feature_request(features, "multi_ack")) - multi_ack = 1; - if (parse_feature_request(features, "no-done")) - no_done = 1; - if (parse_feature_request(features, "thin-pack")) - use_thin_pack = 1; - if (parse_feature_request(features, "ofs-delta")) - use_ofs_delta = 1; - if (parse_feature_request(features, "side-band-64k")) - use_sideband = LARGE_PACKET_MAX; - else if (parse_feature_request(features, "side-band")) - use_sideband = DEFAULT_PACKET_MAX; - if (parse_feature_request(features, "no-progress")) - no_progress = 1; - if (parse_feature_request(features, "include-tag")) - use_include_tag = 1; + parse_features(line + 45); o = parse_object(sha1_buf); if (!o) -- 2.8.0.32.g71f8beb.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html