On Tue, Feb 14, 2023 at 12:07:17PM -0500, Jeff King wrote: > There's a leak in it when there is an ambiguous ref (because we allocate > short_name in each iteration of the loop, rather than overwriting the > buffer). I'll post a fixed version in a moment. OK, here it is. I split it into a few patches to hopefully make it a bit easier to follow. [1/3]: shorten_unambiguous_ref(): avoid integer truncation [2/3]: shorten_unambiguous_ref(): use NUM_REV_PARSE_RULES constant [3/3]: shorten_unambiguous_ref(): avoid sscanf() refs.c | 92 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 45 deletions(-) -Peff