diff mbox series

[11/15] contrib: change the prompt for am-based rebases

Message ID 1c3f8ba328982e633e1431eba3fabcb230821ddc.1576861788.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series rebase: make the default backend configurable | expand

Commit Message

John Cai via GitGitGadget Dec. 20, 2019, 5:09 p.m. UTC
From: Elijah Newren <newren@gmail.com>

The prompt for am-based rebases was REBASE, while for interactive-based
rebases was REBASE-i.  A while ago, we switched merge-based rebases from
using REBASE-m to REBASE-i via re-implementing the merge backend based
on the interactive backend.  We will soon be changing the default rebase
backend to the interactive one, meaning the default prompt will be
REBASE-i rather than REBASE.  We have also noted in the documentation
that currently am-specific options will be implemented in the
interactive backend, and even the --am flag may eventually imply an
interactive-based rebase.  As such, change the prompt for an am-based
rebase from REBASE to REBASE-a.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 contrib/completion/git-prompt.sh | 2 +-
 t/t9903-bash-prompt.sh           | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

SZEDER Gábor Dec. 20, 2019, 11:07 p.m. UTC | #1
The subject prefix for this file is most of the time 'bash prompt' or
'git-prompt'.

On Fri, Dec 20, 2019 at 05:09:44PM +0000, Elijah Newren via GitGitGadget wrote:
> From: Elijah Newren <newren@gmail.com>
> 
> The prompt for am-based rebases was REBASE, while for interactive-based
> rebases was REBASE-i.  A while ago, we switched merge-based rebases from
> using REBASE-m to REBASE-i via re-implementing the merge backend based
> on the interactive backend.  We will soon be changing the default rebase
> backend to the interactive one, meaning the default prompt will be
> REBASE-i rather than REBASE.  We have also noted in the documentation
> that currently am-specific options will be implemented in the
> interactive backend, and even the --am flag may eventually imply an
> interactive-based rebase.  As such, change the prompt for an am-based
> rebase from REBASE to REBASE-a.

I had a bit of a hard time following which rebase variant is
implemented with which backend and when it was changed, and... etc.

Makes me wonder: do we really need those "-i", "-m" or "-a" suffixes?
What benefit do they bring?  Why don't we just say "REBASE" in the
prompt?

> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
>  contrib/completion/git-prompt.sh | 2 +-
>  t/t9903-bash-prompt.sh           | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
> index 1d510cd47b..3c81099d60 100644
> --- a/contrib/completion/git-prompt.sh
> +++ b/contrib/completion/git-prompt.sh
> @@ -440,7 +440,7 @@ __git_ps1 ()
>  			__git_eread "$g/rebase-apply/last" total
>  			if [ -f "$g/rebase-apply/rebasing" ]; then
>  				__git_eread "$g/rebase-apply/head-name" b
> -				r="|REBASE"
> +				r="|REBASE-a"
>  			elif [ -f "$g/rebase-apply/applying" ]; then
>  				r="|AM"
>  			else
> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
> index 88bc733ad6..8da5b1aee2 100755
> --- a/t/t9903-bash-prompt.sh
> +++ b/t/t9903-bash-prompt.sh
> @@ -189,11 +189,11 @@ test_expect_success 'prompt - rebase merge' '
>  	test_cmp expected "$actual"
>  '
>  
> -test_expect_success 'prompt - rebase' '
> -	printf " (b2|REBASE 1/3)" >expected &&
> +test_expect_success 'prompt - rebase am' '
> +	printf " (b2|REBASE-a 1/3)" >expected &&
>  	git checkout b2 &&
>  	test_when_finished "git checkout master" &&
> -	test_must_fail git rebase b1 b2 &&
> +	test_must_fail git rebase --am b1 b2 &&
>  	test_when_finished "git rebase --abort" &&
>  	__git_ps1 >"$actual" &&
>  	test_cmp expected "$actual"
> -- 
> gitgitgadget
>
Elijah Newren Dec. 21, 2019, 12:17 a.m. UTC | #2
On Fri, Dec 20, 2019 at 3:07 PM SZEDER Gábor <szeder.dev@gmail.com> wrote:
>
> The subject prefix for this file is most of the time 'bash prompt' or
> 'git-prompt'.
>
> On Fri, Dec 20, 2019 at 05:09:44PM +0000, Elijah Newren via GitGitGadget wrote:
> > From: Elijah Newren <newren@gmail.com>
> >
> > The prompt for am-based rebases was REBASE, while for interactive-based
> > rebases was REBASE-i.  A while ago, we switched merge-based rebases from
> > using REBASE-m to REBASE-i via re-implementing the merge backend based
> > on the interactive backend.  We will soon be changing the default rebase
> > backend to the interactive one, meaning the default prompt will be
> > REBASE-i rather than REBASE.  We have also noted in the documentation
> > that currently am-specific options will be implemented in the
> > interactive backend, and even the --am flag may eventually imply an
> > interactive-based rebase.  As such, change the prompt for an am-based
> > rebase from REBASE to REBASE-a.
>
> I had a bit of a hard time following which rebase variant is
> implemented with which backend and when it was changed, and... etc.

Sorry about that.  I could fix it up, but...

> Makes me wonder: do we really need those "-i", "-m" or "-a" suffixes?
> What benefit do they bring?  Why don't we just say "REBASE" in the
> prompt?

Ooh, I like this idea.  A lot easier to explain in the commit message
and probably less confusing for users as well.
diff mbox series

Patch

diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 1d510cd47b..3c81099d60 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -440,7 +440,7 @@  __git_ps1 ()
 			__git_eread "$g/rebase-apply/last" total
 			if [ -f "$g/rebase-apply/rebasing" ]; then
 				__git_eread "$g/rebase-apply/head-name" b
-				r="|REBASE"
+				r="|REBASE-a"
 			elif [ -f "$g/rebase-apply/applying" ]; then
 				r="|AM"
 			else
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 88bc733ad6..8da5b1aee2 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -189,11 +189,11 @@  test_expect_success 'prompt - rebase merge' '
 	test_cmp expected "$actual"
 '
 
-test_expect_success 'prompt - rebase' '
-	printf " (b2|REBASE 1/3)" >expected &&
+test_expect_success 'prompt - rebase am' '
+	printf " (b2|REBASE-a 1/3)" >expected &&
 	git checkout b2 &&
 	test_when_finished "git checkout master" &&
-	test_must_fail git rebase b1 b2 &&
+	test_must_fail git rebase --am b1 b2 &&
 	test_when_finished "git rebase --abort" &&
 	__git_ps1 >"$actual" &&
 	test_cmp expected "$actual"