git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-prompt.sh: Show where rebase is at when interrupted by a merge conflict

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 23, 2013, 15:08 UTC
Message-ID
<7vk3ntl1x9.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1366720507-16504-1-git-send-email-zoltan.klinger@gmail.com>
Zoltan Klinger <zoltan.klinger@gmail.com> writes:
Show 30 quoted lines
> When a rebase is interrupted by a merge conflict it could be useful to
> know how far a rebase has progressed and how many commits in total this
> rebase will apply. Teach the __git_ps1() command to display the number
> of commits so far applied and the total number of commits to be applied.
>
> Below is a sample output of the improved __git_ps1() command:
>   ((3ec0a6a...)|REBASE|2/5)
>
> In the example above the rebase has stopped at the second commit due to
> a merge conflict and there are a total number of five commits to be
> applied by this rebase.
>
> This information can be alredy obtained from the following files which are
> being generated during the rebase:
>     GIT_DIR/.git/rebase-merge/msgnum (git-rebase--merge.sh)
>     GIT_DIR/.git/rebase-merge/end    (git-rebase--merge.sh)
>     GIT_DIR/.git/rebase-apply/next   (git-am.sh)
>     GIT_DIR/.git/rebase-apply/last   (git-am.sh)
>
> 1) Modify git-rebase--interactive.sh to also create
>       GIT_DIR/.git/rebase-merge/msgnum
>       GIT_DIR/.git/rebase-merge/end
>    files for the number of commits so far applied and the total number of
>    commits to be applied.
> 2) Modify git-prompt.sh to read and display info from the above files
> 3) Update test t9903-bash-prompt.sh to reflect changes introduced by
>    this patch.
>
> Signed-off-by: Zoltan Klinger <zoltan.klinger@gmail.com>
> ---
Nicely explained.  Felipe?  Szeder?  Comments?
Show 7 quoted lines
>  contrib/completion/git-prompt.sh |   21 ++++++++++++++++-----
>  git-rebase--interactive.sh       |    5 +++++
>  t/t9903-bash-prompt.sh           |    6 +++---
>  3 files changed, 24 insertions(+), 8 deletions(-)
> ...
> -	printf " (b1|REBASE-i)" > expected
> +	printf " (b1|REBASE-i|1/1)" > expected

This makes me wonder if " (b1|REBASE-i 1/1)" may be easier on the eyes. Also it may not be a bad idea to add a new piece to this test to show the state that is not "1/1" but something else.

Previous: Zoltan KlingerNext: Felipe Contreras
Message 2 of 4 in “git-prompt.sh: Show where rebase is at when interrupted by a merge conflict”
  1. git-prompt.sh: Show where rebase is at when interrupted by a merge conflictZoltan Klinger, Apr 23, 2013
  2. Junio C HamanoApr 23, 2013
  3. Felipe ContrerasApr 24, 2013
  4. Eric SunshineApr 24, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.