From: Junio C Hamano <gitster@pobox.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: git@vger.kernel.org, Elijah Newren <newren@gmail.com>,
Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH v2 2/2] status: improve rebase todo list parsing
Date: Sun, 31 May 2026 09:46:35 +0900 [thread overview]
Message-ID: <xmqqbjdwcsno.fsf@gitster.g> (raw)
In-Reply-To: <b80bc1e0a298e2773a2fdab3e73651d59b8d39b7.1777648598.git.phillip.wood@dunelm.org.uk> (Phillip Wood's message of "Fri, 1 May 2026 16:16:39 +0100")
Phillip Wood <phillip.wood123@gmail.com> writes:
> +static void abbrev_oid_in_line(struct repository *r,
> + struct strbuf *line, char **pp)
> +{
> ...
> + have_oid = !repo_get_oid(r, p, &oid);
> + *end_of_object_name = saved;
> + if (!have_oid)
> + goto out; /* object name was a label */
Can there be a label "deadbeef123" that is unrelated to an object whose
object name happens to abbreviate to "deadbeef123"?
> + case TODO_MERGE:
> + skip_dash_c(&p);
> + while (true) {
> + p += strspn(p, " \t");
> + if (!p[0] || (p[0] == '#' && (!p[1] || isspace(p[1]))))
> + break;
> + abbrev_oid_in_line(r, line, &p);
> + }
> + break;
What does this loop do? A "merge" command may look like "merge
[[-C|-c] <commit>] <label>", and we give each whitespace-separated
token to abbrev_oid_in_line()? Would "<label>" that is ambiguous
cause an issue? You may want to limit the scope of what the loop
does a bit, e.g., massage only the token after -C/-c, or something?
> + case TODO_FIXUP:
> + skip_dash_c(&p);
> + /* fallthrough */
> + case TODO_DROP:
> + case TODO_EDIT:
> + case TODO_PICK:
> + case TODO_RESET:
Doesn't RESET also take a <label>? And if it happens to be the same
as an abbreviated object name, e.g., "deadbeef123", of an unrelated
object, would wt-status say "reset deadbeef1", causing a mismatch?
If this is indeed an issue, would moving this to the "no-op" section
below, next to TODO_LABEL, solve it?
> + case TODO_REVERT:
> + case TODO_REWORD:
> + case TODO_SQUASH:
> + abbrev_oid_in_line(r, line, &p);
> + break;
> +
> + /*
> + * Avoid "default" and instead list all the other commands so
> + * that -Wswitch (which is included in -Wall) warns if a new
> + * command is added without handling it in this function.
> + */
> + case TODO_BREAK:
> + case TODO_EXEC:
> + case TODO_LABEL:
> + case TODO_NOOP:
> + case TODO_UPDATE_REF:
> + break;
> }
> - string_list_clear(&split, 0);
> +
> + return true;
> }
next prev parent reply other threads:[~2026-05-31 0:46 UTC|newest]
Thread overview: 16+ 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
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-31 0:46 ` Junio C Hamano [this message]
2026-06-01 15:20 ` 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=xmqqbjdwcsno.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=newren@gmail.com \
--cc=phillip.wood123@gmail.com \
--cc=ps@pks.im \
/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