Re: [PATCH v2] fetch-pack: write effective filter to trace2
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 25, 2022, 18:56 UTC
- Message-ID
- <xmqqtu753tti.fsf@gitster.g>
- In-Reply-To
- <xmqqwncadwzh.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 29 quoted lines
> Jonathan Tan <jonathantanmy@google.com> writes:
>
>> +static void write_and_trace_filter(struct fetch_pack_args *args,
>> + struct strbuf *req_buf,
>> + int server_supports_filter)
>> +{
>> +...
>> +}
>
> The previous round already had the same issue, but this makes it
> even worse by introducing a function that makes it clear that it
> mixes quite unrelated two features (i.e. write the filter to the
> other end, which MUST be done for correct operation of the protocol,
> and write a log to trace2, which may not be even necessary when we
> are not logging at all).
> ...
> In a sense, we can say that the only purpose this helper function is
> to tell the server end what the filter we use is by renaming it; it
> is OK to have debugging statements and logging code as part of the
> implementation of such a function.
>
> I actually like that direction better. A helper function may exist
> *ONLY* to trace, in which case, having "trace" in its name would
> make perfect sense. A helper function may exist to perform the real
> work, but it may log what it did to perform the real work as well.
> I think the latter shouldn't have "trace" in its name at all, or our
> helpers will all be called do_FOO_and_trace(), do_BAR_and_debug(),
> etc., which is nonsense. Just calling do_FOO() and do_BAR(), and
> then having them log or trace as needed, is fine.After waiting for a week, I still haven't seen any correction to this patch, but do you want to give the helper function a bit more sensible name in an updated patch, perhaps say "send_filter()" or something?
Otherwise the topic looked good.
Thanks.