Skip to content

Commit 1306321

Browse files
felipecgitster
authored andcommitted
prompt: fix for simple rebase
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent edca415 commit 1306321

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

contrib/completion/git-prompt.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ __git_ps1 ()
279279
step=$(cat "$g/rebase-apply/next")
280280
total=$(cat "$g/rebase-apply/last")
281281
if [ -f "$g/rebase-apply/rebasing" ]; then
282+
b="$(cat "$g/rebase-apply/head-name")"
282283
r="|REBASE"
283284
elif [ -f "$g/rebase-apply/applying" ]; then
284285
r="|AM"
@@ -295,6 +296,7 @@ __git_ps1 ()
295296
r="|BISECTING"
296297
fi
297298

299+
test -n "$b" ||
298300
b="$(git symbolic-ref HEAD 2>/dev/null)" || {
299301
detached=yes
300302
b="$(

t/t9903-bash-prompt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ test_expect_success 'prompt - rebase merge' '
276276
'
277277

278278
test_expect_success 'prompt - rebase' '
279-
printf " ((t2)|REBASE 1/3)" > expected &&
279+
printf " (b2|REBASE 1/3)" > expected &&
280280
git checkout b2 &&
281281
test_when_finished "git checkout master" &&
282282
test_must_fail git rebase b1 b2 &&

0 commit comments

Comments
 (0)