summaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorZoltan Klinger <zoltan.klinger@gmail.com>2013-04-25 19:28:54 +1000
committerJunio C Hamano <gitster@pobox.com>2013-04-25 09:59:34 -0700
commitb71dc3e1a04666fae4a4e282973d9b5a122a997c (patch)
tree913563c29ad952c8b35da583e0a5e84e2899c884 /git-rebase--interactive.sh
parent3e7bb5da9f58a8b0d066d1511ab95b5df2f8c6b1 (diff)
downloadgit-b71dc3e1a04666fae4a4e282973d9b5a122a997c.tar.gz
bash-prompt.sh: show where rebase is at when stopped
When a rebase stops (e.g. 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, like this: ((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 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) but "rebase -i" does not leave necessary clues. Implement this feature by doing these three things: 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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--interactive.sh')
-rw-r--r--git-rebase--interactive.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 048a140a6f..5822b2c592 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"
if test "$last_count" != "$new_count"
then
last_count=$new_count