From: Junio C Hamano Date: Tue, 14 Feb 2017 19:35:48 GMT Subject: Re: [PATCH] show-branch: fix crash with long ref name Message-ID: In-Reply-To: <20170214172526.hzpm3d3ubd3vjnzr@sigill.intra.peff.net> Jeff King writes: > This fixes the problem, but I think we can simplify it quite a bit by > using resolve_refdup(). Here's the patch series I ended up with: > > [1/3]: show-branch: drop head_len variable > [2/3]: show-branch: store resolved head in heap buffer > [3/3]: show-branch: use skip_prefix to drop magic numbers > > builtin/show-branch.c | 39 ++++++++++++--------------------------- > 1 file changed, 12 insertions(+), 27 deletions(-) Yes, the whole thing is my fault ;-) and I agree with what these patches do. The second one lacks free(head) but I think that is OK; it is something we allocate in cmd_*() and use pretty much thruout the rest of the program. Thanks.