]> git.ipfire.org Git - thirdparty/git.git/commit
status: improve rebase todo list parsing
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Tue, 23 Jun 2026 15:53:57 +0000 (16:53 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 23 Jun 2026 19:18:48 +0000 (12:18 -0700)
commit6f34e5f9e3b664fcd65a2a0695dff16b0ee04b35
treecb29ac3141a11a923f473874b229c92a55950440
parent10c2678a2bfbd2a3e8d0a3623d1b71b6cc916253
status: improve rebase todo list parsing

When there is rebase in progress "git status" displays the last couple
of completed and the next couple of pending commands from the todo
list. When it does this it tries to abbreviate the object ids of
the commits to be picked. Unfortunately it does not abbreviate the
object ids when the line starts with "fixup -C" or "merge -C". It
also mistakenly replaces the refname in "reset main" and "update-ref
refs/heads/main" with the object id that the ref points to.

Fix this by using the function added in the last commit to parse the
command name and only try to abbreviate the argument for commands that
take an object id. If a command accepts a label then try to resolve the
object name as a label first and only if that fails try to resolve it
as an object_id. When trying to abbreviate an object id, only replace
the object name if it starts with the abbreviated object id so that
tag or branch names that contain only hex digits are left unchanged.

Comments are now processed after stripping any leading
whitespace from the line. This matches what the sequencer does in
parse_insn_line(). The existing test cases are updated to test a
wider variety of commands. Only the pending commands in the tests
are changed to avoid removing existing coverage.

Helped-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7512-status-help.sh
wt-status.c