]> git.ipfire.org Git - thirdparty/git.git/commitdiff
prompt: fix for simple rebase
authorFelipe Contreras <felipe.contreras@gmail.com>
Wed, 29 May 2013 06:21:28 +0000 (01:21 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 29 May 2013 18:27:56 +0000 (11:27 -0700)
When we are rebasing without options ('am' mode), the head rebased lives
in '$g/rebase-apply/head-name', so lets use that information so it's
reported the same way as if we were doing other rebases (-i or -m).

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-prompt.sh
t/t9903-bash-prompt.sh

index eaf5c369aacde207cbad4c9df9574e7b26634bb7..bbf7657142d9aff8e2b0b7defea49234ce2a13d7 100644 (file)
@@ -279,6 +279,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"
@@ -295,6 +296,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 &&