Re: [PATCH 02/18] receive-pack: parse feature request a bit earlier
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 19, 2014, 22:31 UTC
- Message-ID
- <xmqqbnrgun5o.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1408485987-3590-3-git-send-email-gitster@pobox.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 32 quoted lines
> Ideally, we should have also allowed the first "shallow" to carry
> the feature request trailer, but that is water under the bridge
> now. This makes the next step to factor out the queuing of commands
> easier to review.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> ...
> @@ -853,7 +853,18 @@ static struct command *read_head_info(struct sha1_array *shallow)
> continue;
> }
>
> - if (len < 83 ||
> + linelen = strlen(line);
> + if (linelen < len) {
> + const char *feature_list = line + linelen + 1;
> + if (parse_feature_request(feature_list, "report-status"))
> + report_status = 1;
> + if (parse_feature_request(feature_list, "side-band-64k"))
> + use_sideband = LARGE_PACKET_MAX;
> + if (parse_feature_request(feature_list, "quiet"))
> + quiet = 1;
> + }
> +
> + if (linelen < 83 ||
> line[40] != ' ' ||
> line[81] != ' ' ||
> get_sha1_hex(line, old_sha1) ||
> @@ -863,15 +874,6 @@ static struct command *read_head_info(struct sha1_array *shallow)
>
> refname = line + 82;
> reflen = strlen(refname);A later patch updates this to "reflen = linelen - 82" while moving this code to a helper function, but it may be better to do that in this patch.