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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 25, 2013, 17:05 UTC
Message-ID
<7vk3nq4k3b.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1366882134-12026-1-git-send-email-zoltan.klinger@gmail.com>
Zoltan Klinger <zoltan.klinger@gmail.com> writes:
> When a rebase is interrupted by a merge conflict it could be useful to

The command also stops when told to stop with "amend", etc. no? I would phrase this way "When a rebase stops (e.g. interrupted ...), it could be useful...".

Show 6 quoted lines
> This information can be already 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)
Here, I would add:
	But "git rebase -i" did not leave enough clues.
Show 6 quoted lines
> 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
Missing full-stop at the end.
Show 5 quoted lines
> 3) Update test t9903-bash-prompt.sh to reflect changes introduced by
>    this patch.
>
> Signed-off-by: Zoltan Klinger <zoltan.klinger@gmail.com>
> ---
Thanks.
Show 21 quoted lines
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 048a140..f76ff8f 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -57,6 +57,9 @@ rewritten="$state_dir"/rewritten
>  
>  dropped="$state_dir"/dropped
>  
> +end="$state_dir"/end
> +msgnum="$state_dir"/msgnum
> +
>  # A script to set the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and
>  # GIT_AUTHOR_DATE that will be used for the commit that is currently
>  # being rebased.
> @@ -109,7 +112,9 @@ mark_action_done () {
>  	sed -e 1d < "$todo" >> "$todo".new
>  	mv -f "$todo".new "$todo"
>  	new_count=$(git stripspace --strip-comments <"$done" | wc -l)
> +	echo $new_count > $msgnum
>  	total=$(($new_count + $(git stripspace --strip-comments <"$todo" | wc -l)))
> +	echo $total > $end
Write them like this:
	echo foo >"$variable"

Having no SP between redirection operator and redirection target is merely a style thing [*1*]. Having an unnecessary dq around a variable name that is used as redirection target is to work around a bug in certain versions of bash that issues useless warnings.

I'll locally squeeze the above suggestions in and queue the result. Please check what will appear on 'pu' by the end of day.

Thanks.
[Footnote]
*1* But a style request is not optional ;-)
Previous: Zoltan Klinger
Message 2 of 2 in “bash-prompt.sh: Show where rebase is at when interrupted by a merge conflict”
  1. bash-prompt.sh: Show where rebase is at when interrupted by a merge conflictZoltan Klinger, Apr 25, 2013
  2. Junio C HamanoApr 25, 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.