Skip to content

Commit

Permalink
prompt: fix for simple rebase
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Felipe Contreras authored and Junio C Hamano committed May 29, 2013
1 parent edca415 commit 1306321
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions contrib/completion/git-prompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -295,6 +296,7 @@ __git_ps1 ()
r="|BISECTING"
fi

test -n "$b" ||
b="$(git symbolic-ref HEAD 2>/dev/null)" || {
detached=yes
b="$(
Expand Down
2 changes: 1 addition & 1 deletion t/t9903-bash-prompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit 1306321

Please sign in to comment.