Re: [PATCH v2 09/11] upload-pack, serve: log received client trace2 SID
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 4, 2020, 21:26 UTC
- Message-ID
- <xmqqeel8lso1.fsf@gitster.c.googlers.com>
- In-Reply-To
- <23f44bc904dfdd31f68a27c587b4b61df4bc0041.1604355792.git.steadmon@google.com>
Josh Steadmon <steadmon@google.com> writes:
Show 18 quoted lines
> diff --git a/upload-pack.c b/upload-pack.c
> index 3bb01c5427..d938603c97 100644
> --- a/upload-pack.c
> +++ b/upload-pack.c
> @@ -1058,6 +1058,7 @@ static void receive_needs(struct upload_pack_data *data,
> const char *features;
> struct object_id oid_buf;
> const char *arg;
> + int feature_len;
>
> reset_timeout(data->timeout);
> if (packet_reader_read(reader) != PACKET_READ_NORMAL)
> @@ -1109,6 +1110,12 @@ static void receive_needs(struct upload_pack_data *data,
> if (data->allow_filter &&
> parse_feature_request(features, "filter"))
> data->filter_capability_requested = 1;
> + if ((arg = parse_feature_value(features, "trace2-sid", &feature_len, NULL)))
> + {Style. '{' block is opened on the same line as "if (condition)" ends, e.g.
arg = parse_feature_value(...);
if (arg) {Avoid assignment in the condition part of if/while unless there is a compelling reason to do so. e.g.
if ((arg = ...) && further_check_on(arg)) {
...might be justifiable, but here, I do not see any such reason.
Show 7 quoted lines
> + char *client_sid = xstrndup(arg, feature_len);
> + trace2_data_string("trace2", NULL, "client-sid", client_sid);
> + free(client_sid);
> + }
>
> o = parse_object(the_repository, &oid_buf);
> if (!o) {Thanks.