Subject: Re: [PATCH 2/2] status: improve rebase todo list parsing

From: Tian Yuchen <[email-masked]>
Date: Tue, 21 Apr 2026 00:38:54 +0800

Hi Phillip,

On 4/20/26 23:04, Phillip Wood wrote:

> +	if (!starts_with(p, abbrev))
> +		goto out; /* object name was a refname containing only xdigits */
> +	p += strlen(abbrev);
> +	strbuf_remove(line, p - line->buf, end_of_object_name - p);
> +	end_of_object_name = p;

> -	if ((2 <= string_list_split(&split, line->buf, " ", 2)) &&
> -	    !repo_get_oid(r, split.items[1].string, &oid)) {
> -		strbuf_reset(line);
> -		strbuf_addf(line, "%s ", split.items[0].string);
> -		strbuf_add_unique_abbrev(line, &oid, DEFAULT_ABBREV);
> -		for (size_t i = 2; i < split.nr; i++)
> -			strbuf_addf(line, " %s", split.items[i].string);

I noticed that after this patch, refnames shorter than seven characters 
are no longer standardised to the standard seven-character length, 
because the 'start_with()' function always returns FALSE. The code jumps 
directly to 'out', without completing or cutting the refname.

I’m not sure if this was your intention, but I just want to point it out 
for your information.

(Also noted that there is a very rare scenario where the OID of a 
refname longer than 7 characters happens to begin with the refname 
itself; in this case, 'start_with' returns TRUE and the string is cut 
incorrectly. However, I think we can safely ignore this.)

Regards, Yuchen