From: Phillip Wood <phillip.wood123@gmail.com>
To: Tian Yuchen <cat@malon.dev>,
Phillip Wood <phillip.wood@dunelm.org.uk>,
git@vger.kernel.org
Subject: Re: [PATCH 2/2] status: improve rebase todo list parsing
Date: Tue, 21 Apr 2026 17:03:35 +0100 [thread overview]
Message-ID: <9b239518-7b1c-4125-939e-38ebe69ed004@gmail.com> (raw)
In-Reply-To: <b62a96c5-fab4-4c6d-9768-ade48a8476ca@malon.dev>
Hi Tian
On 20/04/2026 17:38, Tian Yuchen wrote:
> 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.
Do you mean object id's rather than refnames? We do not want to alter
refnames, but we do want to abbreviate object ids. You're right that if
the todo list contains an object id that is shorter than the default
abbreviation length it will not be expanded but "git rebase" rewrites
the todo list to contain full length object ids after the user has
edited it. If a user may edit the todo list directly without using "git
rebase --edit-todo" and then run "git status" before "git rebase
--continue" the todo list could contain shorter object ids but that
seems pretty unlikely.
>
> 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.)
Yes, I think that's unlikely to happen in practice.
Thanks
Phillip
> Regards, Yuchen
next prev parent reply other threads:[~2026-04-21 16:03 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
2026-04-21 16:03 ` Phillip Wood [this message]
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=9b239518-7b1c-4125-939e-38ebe69ed004@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=cat@malon.dev \
--cc=git@vger.kernel.org \
--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