Re: [PATCH 2/2] branch, for-each-ref: add option to omit empty lines
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 30, 2023, 17:21 UTC
- Message-ID
- <xmqq355m17g0.fsf@gitster.g>
- In-Reply-To
- <20230330112133.4437-3-oystwa@gmail.com>
Øystein Walle <oystwa@gmail.com> writes:
> The logic is more or less duplicated in branch.c and for-each-ref.c > which I don't like. However I couldn't really find a "central" place to > put it. Imo. it's definitely not a property of the format or the filter, > so struct ref_format and struct ref_filter are no good.
I think the division of labor is very much in line with how the ref-filter API is currently laid out. Enumerating is done calling filter_refs(), and result is returned in an array, which the caller adds whatever frills around its elements to show them in the output. The "adding frills" is aided by calling format_ref_array_item(), but the API does not care how the formatting result is used.