On Mon, Feb 26, 2024 at 7:10 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Christian Couder <christian.couder@xxxxxxxxx> writes: > > > Unfortunately strbuf_add() calls strbuf_grow() itself which is not > > needed as we have already called strbuf_grow() to avoid repeated > > reallocation. > > Why is it unfortunate? If the current allocation is sufficient, it > is a cheap no-op, isn't it (if not, we should make it so)? Yeah, I agree that we don't need to be extra efficient and calling strbuf_grow() doesn't add much overhead. So let's just use strbuf_add() repeatedly after calling it once.