Skip to content

Commit 6d04ce7

Browse files
newrengitster
authored andcommitted
git-prompt: change the prompt for interactive-based rebases
In the past, we had different prompts for different types of rebases: REBASE: for am-based rebases REBASE-m: for merge-based rebases REBASE-i: for interactive-based rebases It's not clear why this distinction was necessary or helpful; when the prompt was added in commit e752019 ("Improve bash prompt to detect various states like an unfinished merge", 2007-09-30), it simply added these three different types. Perhaps there was a useful purpose back then, but there have been some changes: * The merge backend was deleted after being implemented on top of the interactive backend, causing the prompt for merge-based rebases to change from REBASE-m to REBASE-i. * The interactive backend is used for multiple different types of non-interactive rebases, so the "-i" part of the prompt doesn't really mean what it used to. * Rebase backends have gained more abilities and have a great deal of overlap, sometimes making it hard to distinguish them. * Behavioral differences between the backends have also been ironed out. * We want to change the default backend from am to interactive, which means people would get "REBASE-i" by default if we didn't change the prompt, and only if they specified --am or --whitespace or -C would they get the "REBASE" prompt. * In the future, we plan to have "--whitespace", "-C", and even "--am" run the interactive backend once it can handle everything the am-backend can. For all these reasons, make the prompt for any type of rebase just be "REBASE". Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 52eb738 commit 6d04ce7

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

contrib/completion/git-prompt.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,7 @@ __git_ps1 ()
429429
__git_eread "$g/rebase-merge/head-name" b
430430
__git_eread "$g/rebase-merge/msgnum" step
431431
__git_eread "$g/rebase-merge/end" total
432-
if [ -f "$g/rebase-merge/interactive" ]; then
433-
r="|REBASE-i"
434-
else
435-
r="|REBASE-m"
436-
fi
432+
r="|REBASE"
437433
else
438434
if [ -d "$g/rebase-apply" ]; then
439435
__git_eread "$g/rebase-apply/next" step

t/t9903-bash-prompt.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ test_expect_success 'prompt - inside bare repository' '
163163
'
164164

165165
test_expect_success 'prompt - interactive rebase' '
166-
printf " (b1|REBASE-i 2/3)" >expected &&
166+
printf " (b1|REBASE 2/3)" >expected &&
167167
write_script fake_editor.sh <<-\EOF &&
168168
echo "exec echo" >"$1"
169169
echo "edit $(git log -1 --format="%h")" >>"$1"
@@ -180,7 +180,7 @@ test_expect_success 'prompt - interactive rebase' '
180180
'
181181

182182
test_expect_success 'prompt - rebase merge' '
183-
printf " (b2|REBASE-i 1/3)" >expected &&
183+
printf " (b2|REBASE 1/3)" >expected &&
184184
git checkout b2 &&
185185
test_when_finished "git checkout master" &&
186186
test_must_fail git rebase --merge b1 b2 &&
@@ -189,11 +189,11 @@ test_expect_success 'prompt - rebase merge' '
189189
test_cmp expected "$actual"
190190
'
191191

192-
test_expect_success 'prompt - rebase' '
192+
test_expect_success 'prompt - rebase am' '
193193
printf " (b2|REBASE 1/3)" >expected &&
194194
git checkout b2 &&
195195
test_when_finished "git checkout master" &&
196-
test_must_fail git rebase b1 b2 &&
196+
test_must_fail git rebase --am b1 b2 &&
197197
test_when_finished "git rebase --abort" &&
198198
__git_ps1 >"$actual" &&
199199
test_cmp expected "$actual"

0 commit comments

Comments
 (0)