Jeff King <peff@xxxxxxxx> 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.