From: Junio C Hamano Date: Thu, 30 Mar 2023 17:21:19 GMT Subject: Re: [PATCH 2/2] branch, for-each-ref: add option to omit empty lines Message-ID: In-Reply-To: <20230330112133.4437-3-oystwa@gmail.com> Øystein Walle 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.