Skip to content

status: improve rebase todo list parsing

Phillip Wood git 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 0 repliesNew
  2. v32 patches 5 repliesSuperseded
  3. v22 patches 5 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches7 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2sequencer: factor out parsing of todo commandssequencer.c sequencer.h+38 -150 replies
2/2status: improve rebase todo list parsingt/t7512-status-help.sh wt-status.c+175 -530 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchElijah Newren
1/2
2/2Helped-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/2] 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 is 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.

This series fixes that. The first patch factors out the sequencer code that parses the command names in the todo list. The second patch uses that function in "git status" to parse the command names so that it knows whether the line may contain "-C" and whether there is an object id that should be abbreviated.

Thanks to Junio for his comments on V3.

Changes since V3:

Patch 2 - Style fix for cast.

Changes since V2:

Patch 2 - Check if the object name is a label before trying to
abbreviate it.

Note that a number of the CI jobs fail[1] due to the rather old base, but a test merge of this branch with "master" passes[2]

[1] https://github.com/phillipwood/git/actions/runs/27906115900
[2] https://github.com/phillipwood/git/actions/runs/27908204055

Changes since V1:

Patch 1 - Expanded commit message and added a code comment.

Patch 2 - Fixed some typos, added a code comment and clarified that -Wswitch
is included by -Wall.

Base-Commit: 8c9303b1ffae5b745d1b0a1f98330cf7944d8db0
Published-As: https://github.com/phillipwood/git/releases/tag/pw%2Fimprove-status-todo-list-parsing%2Fv4
View-Changes-At: https://github.com/phillipwood/git/compare/8c9303b1f...90c4659b8
Fetch-It-Via: git fetch https://github.com/phillipwood/git pw/improve-status-todo-list-parsing/v4

Phillip Wood (2):
sequencer: factor out parsing of todo commands
status: improve rebase todo list parsing

 sequencer.c            |  45 ++++++++----
 sequencer.h            |   8 +++
 t/t7512-status-help.sh |  74 +++++++++++++-------
 wt-status.c            | 154 +++++++++++++++++++++++++++++++++--------
 4 files changed, 213 insertions(+), 68 deletions(-)

Range-diff against v3:

1:  d27dddff931 = 1:  d27dddff931 sequencer: factor out parsing of todo commands
2:  b3514e9b1c9 ! 2:  90c4659b87e status: improve rebase todo list parsing
    @@ wt-status.c: static int split_commit_in_progress(struct wt_status *s)
     +	struct strbuf scratch = STRBUF_INIT;
     +	char *p = line->buf;
     +
    -+	if (!sequencer_parse_todo_command((const char**)&p, &cmd))
    ++	if (!sequencer_parse_todo_command((const char **)&p, &cmd))
     +		return true; /* keep invalid lines */
     +
     +	switch (cmd) {
Signature · 1 line
2.54.0.200.gfd8d68259e3