Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:57:00

Zoltan Klinger [off-list ref] 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...".
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.
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.
3) Update test t9903-bash-prompt.sh to reflect changes introduced by
   this patch.

Signed-off-by: Zoltan Klinger <redacted>
---
Thanks.
quoted hunk
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 ;-)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help