Git development
 help / color / mirror / Atom feed
From: Tian Yuchen <cat@malon.dev>
To: Phillip Wood <phillip.wood@dunelm.org.uk>, git@vger.kernel.org
Cc: Phillip Wood <phillip.wood123@gmail.com>
Subject: Re: [PATCH 2/2] status: improve rebase todo list parsing
Date: Tue, 21 Apr 2026 00:38:54 +0800	[thread overview]
Message-ID: <b62a96c5-fab4-4c6d-9768-ade48a8476ca@malon.dev> (raw)
In-Reply-To: <d20dc1f6550078883995ae963b91faaa00984c6e.1776697483.git.phillip.wood@dunelm.org.uk>

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

  reply	other threads:[~2026-04-20 16:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 15:04 [PATCH 0/2] status: improve rebase todo list parsing Phillip Wood
2026-04-20 15:04 ` [PATCH 1/2] sequencer: factor out parsing of todo commands Phillip Wood
2026-04-22  0:32   ` Elijah Newren
2026-04-20 15:04 ` [PATCH 2/2] status: improve rebase todo list parsing Phillip Wood
2026-04-20 16:38   ` Tian Yuchen [this message]
2026-04-21 16:03     ` Phillip Wood
2026-04-22  0:32   ` Elijah Newren
2026-04-22 13:28     ` Patrick Steinhardt
2026-04-22 14:14       ` Phillip Wood
2026-04-22 14:15     ` Phillip Wood
2026-05-01 15:16 ` [PATCH v2 0/2] " Phillip Wood
2026-05-01 15:16   ` [PATCH v2 1/2] sequencer: factor out parsing of todo commands Phillip Wood
2026-05-01 15:16   ` [PATCH v2 2/2] status: improve rebase todo list parsing Phillip Wood
2026-05-01 18:19   ` [PATCH v2 0/2] " Phillip Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b62a96c5-fab4-4c6d-9768-ade48a8476ca@malon.dev \
    --to=cat@malon.dev \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood123@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox