Re: [PATCH v2] [GSOC] ref-filter: use single strbuf for all output
- From
Jeff King <peff@peff.net>
- Date
- Apr 8, 2021, 14:32 UTC
- Message-ID
- <YG8UD7c4lChOQM5a@coredump.intra.peff.net>
- In-Reply-To
- <CAOLTT8QvdLeWz=cDOoVFV8Lrk2QL2wf_jwDc6oK5j+6gup+Png@mail.gmail.com>
On Thu, Apr 08, 2021 at 08:18:59PM +0800, ZheNing Hu wrote:
Show 13 quoted lines
> > I think this is a reasonable direction to take the solution: wrapping > > the loop so that the reuse of the buffers can be included there. > > > > But I do wonder if we should go the opposite direction, and get rid of > > show_ref_array_item() entirely. It only has two callers, both of which > > could just write the loop themselves. That is more code, but perhaps it > > would make it more clear what is going on in those callers, and to give > > them more flexibility. > > > > Indeed. I think `pretty_print_ref()` is proof that we may need to keep > `show_ref_array_item()` because If it modified to `show_ref_array_items(...,1);` > it will look very strange.
What I meant was that we should get rid of show_ref_array_items(), as well, and just use format_ref_array_item() everywhere. This whole wrapper is only saving us a few lines, and it makes it harder to see what the function is doing. Likewise for pretty-print ref. But I dunno. Maybe that is all going too far.
-Peff