Merge branch 'fc/show-branch-in-rebase-am'
authorJunio C Hamano <gitster@pobox.com>
Thu, 6 Jun 2013 19:18:41 +0000 (12:18 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Jun 2013 19:18:41 +0000 (12:18 -0700)
The bash prompt code (in contrib/) displayed the name of the branch
being rebased when "rebase -i/-m/-p" modes are in use, but not the
plain vanilla "rebase".

* fc/show-branch-in-rebase-am:
prompt: fix for simple rebase

contrib/completion/git-prompt.sh
t/t9903-bash-prompt.sh
index 9f4e6a368cf590ccfc9e469ad8820e2af93c3568..86a4f3fa49cf68e14a6b0de13cb7f63fe8a2624d 100644 (file)
@@ -360,6 +360,7 @@ __git_ps1 ()
                                step=$(cat "$g/rebase-apply/next")
                                total=$(cat "$g/rebase-apply/last")
                                if [ -f "$g/rebase-apply/rebasing" ]; then
+                                       b="$(cat "$g/rebase-apply/head-name")"
                                        r="|REBASE"
                                elif [ -f "$g/rebase-apply/applying" ]; then
                                        r="|AM"
@@ -376,6 +377,7 @@ __git_ps1 ()
                                r="|BISECTING"
                        fi
 
+                       test -n "$b" ||
                        b="$(git symbolic-ref HEAD 2>/dev/null)" || {
                                detached=yes
                                b="$(
index 083b319ed11132ae03c1f653f1ba13149f5a1ebe..15521cc4f9be68ccd105916cee1322041682e8d5 100755 (executable)
@@ -276,7 +276,7 @@ test_expect_success 'prompt - rebase merge' '
 '
 
 test_expect_success 'prompt - rebase' '
-       printf " ((t2)|REBASE 1/3)" > expected &&
+       printf " (b2|REBASE 1/3)" > expected &&
        git checkout b2 &&
        test_when_finished "git checkout master" &&
        test_must_fail git rebase b1 b2 &&