git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Add shell completion for git remote rm
@ 2017-12-29  2:01 Keith Smiley
  2017-12-29  3:29 ` Todd Zullinger
  2017-12-29  6:00 ` Kevin Daudt
  0 siblings, 2 replies; 23+ messages in thread
From: Keith Smiley @ 2017-12-29  2:01 UTC (permalink / raw)
  To: git

From: Keith Smiley <keithbsmiley@gmail.com>

Previously git remote rm did not complete your list of removes as remove
does.
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 3683c772c5586..3e9044087e6ba 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2665,7 +2665,7 @@ _git_config ()
 _git_remote ()
 {
 	local subcommands="
-		add rename remove set-head set-branches
+		add rename remove rm set-head set-branches
 		get-url set-url show prune update
 		"
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"

--
https://github.com/git/git/pull/448

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2017-12-29  2:01 [PATCH] Add shell completion for git remote rm Keith Smiley
@ 2017-12-29  3:29 ` Todd Zullinger
  2017-12-29  4:19   ` Keith Smiley
  2017-12-29  6:00 ` Kevin Daudt
  1 sibling, 1 reply; 23+ messages in thread
From: Todd Zullinger @ 2017-12-29  3:29 UTC (permalink / raw)
  To: Keith Smiley; +Cc: git, Nguyễn Thái Ngọc Duy

Hi Keith,

Keith Smiley wrote:
> Previously git remote rm did not complete your list of removes as remove
> does.

Looking through the history, the rm subcomand completion was
explicitly removed in e17dba8fe1 ("remote: prefer subcommand
name 'remove' to 'rm'", 2012-09-06).

-- 
Todd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Genius is 1% inspiration and 99% perspiration, which is why engineers
sometimes smell really bad.
    -- Demotivators (www.despair.com)


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2017-12-29  3:29 ` Todd Zullinger
@ 2017-12-29  4:19   ` Keith Smiley
  2017-12-29 13:52     ` Todd Zullinger
  2018-01-01 23:46     ` Duy Nguyen
  0 siblings, 2 replies; 23+ messages in thread
From: Keith Smiley @ 2017-12-29  4:19 UTC (permalink / raw)
  To: Todd Zullinger; +Cc: git, Nguyễn Thái Ngọc Duy

It looks like that was just about preferring remove in documentation and 
the like, I think it would still make sense to have both for completion 
since rm is still supported.

--
Keith Smiley

On 12/28, Todd Zullinger wrote:
>Hi Keith,
>
>Keith Smiley wrote:
>> Previously git remote rm did not complete your list of removes as remove
>> does.
>
>Looking through the history, the rm subcomand completion was
>explicitly removed in e17dba8fe1 ("remote: prefer subcommand
>name 'remove' to 'rm'", 2012-09-06).
>
>-- 
>Todd
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Genius is 1% inspiration and 99% perspiration, which is why engineers
>sometimes smell really bad.
>    -- Demotivators (www.despair.com)
>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2017-12-29  2:01 [PATCH] Add shell completion for git remote rm Keith Smiley
  2017-12-29  3:29 ` Todd Zullinger
@ 2017-12-29  6:00 ` Kevin Daudt
  2017-12-29  6:21   ` Keith Smiley
  1 sibling, 1 reply; 23+ messages in thread
From: Kevin Daudt @ 2017-12-29  6:00 UTC (permalink / raw)
  To: Keith Smiley; +Cc: git

On Fri, Dec 29, 2017 at 02:01:00AM +0000, Keith Smiley wrote:
> From: Keith Smiley <keithbsmiley@gmail.com>
> 
> Previously git remote rm did not complete your list of removes as remove
> does.

Your signed-off-by[1] is missing, could you please add that?

[1]:
https://github.com/git/git/blob/master/Documentation/SubmittingPatches#L278

> ---
>  contrib/completion/git-completion.bash | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 3683c772c5586..3e9044087e6ba 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2665,7 +2665,7 @@ _git_config ()
>  _git_remote ()
>  {
>  	local subcommands="
> -		add rename remove set-head set-branches
> +		add rename remove rm set-head set-branches
>  		get-url set-url show prune update
>  		"
>  	local subcommand="$(__git_find_on_cmdline "$subcommands")"
> 
> --
> https://github.com/git/git/pull/448

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2017-12-29  6:00 ` Kevin Daudt
@ 2017-12-29  6:21   ` Keith Smiley
  0 siblings, 0 replies; 23+ messages in thread
From: Keith Smiley @ 2017-12-29  6:21 UTC (permalink / raw)
  To: Kevin Daudt; +Cc: git

Sorry about that! Patch below.


Previously git remote rm did not complete your list of removes as remove
does.

Signed-off-by: Keith Smiley <k@keith.so>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 3683c772c5586..3e9044087e6ba 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2665,7 +2665,7 @@ _git_config ()
 _git_remote ()
 {
 	local subcommands="
-		add rename remove set-head set-branches
+		add rename remove rm set-head set-branches
 		get-url set-url show prune update
 		"
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"

--
Keith Smiley

On 12/29, Kevin Daudt wrote:
>On Fri, Dec 29, 2017 at 02:01:00AM +0000, Keith Smiley wrote:
>> From: Keith Smiley <keithbsmiley@gmail.com>
>>
>> Previously git remote rm did not complete your list of removes as remove
>> does.
>
>Your signed-off-by[1] is missing, could you please add that?
>
>[1]:
>https://github.com/git/git/blob/master/Documentation/SubmittingPatches#L278
>
>> ---
>>  contrib/completion/git-completion.bash | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>> index 3683c772c5586..3e9044087e6ba 100644
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -2665,7 +2665,7 @@ _git_config ()
>>  _git_remote ()
>>  {
>>  	local subcommands="
>> -		add rename remove set-head set-branches
>> +		add rename remove rm set-head set-branches
>>  		get-url set-url show prune update
>>  		"
>>  	local subcommand="$(__git_find_on_cmdline "$subcommands")"
>>
>> --
>> https://github.com/git/git/pull/448

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2017-12-29  4:19   ` Keith Smiley
@ 2017-12-29 13:52     ` Todd Zullinger
  2017-12-29 16:49       ` [PATCH] completion: restore 'remote rm' Keith Smiley
  2017-12-29 22:48       ` [PATCH] Add shell completion for git remote rm SZEDER Gábor
  2018-01-01 23:46     ` Duy Nguyen
  1 sibling, 2 replies; 23+ messages in thread
From: Todd Zullinger @ 2017-12-29 13:52 UTC (permalink / raw)
  To: Keith Smiley; +Cc: git, Nguyễn Thái Ngọc Duy, Kevin Daudt

Keith Smiley wrote:
> It looks like that was just about preferring remove in documentation
> and the like, I think it would still make sense to have both for
> completion since rm is still supported.

I read it as a first step in a long process to eventually
remove 'remote rm', but if that's never intended, then sure,
restoring completion for it seems reasonable.

It would be good to hear from those who know or recall the
intention.

I think we should only complete the preferred subcommand.
That encourages use of 'remote remove' even if 'remote rm'
will stay forever to avoid breaking existing scripts.

If it does make sense to restore completion, adding a link
back to e17dba8fe1 and explaining why the completion is
being restored would be good.  Reading the commit message
now makes it sound like 'remote rm' was never present and is
being added to correct an oversight.

Maybe something like:

    completion: restore 'remote rm'

    e17dba8fe1 ("remote: prefer subcommand name 'remove' to
    'rm'", 2012-09-06) removed the 'rm' subcommand from
    completion.  The 'remote rm' subcommand is still supported
    and not planned to be removed.  Offer completions for it.

I also noticed that in your original commit that you say
"list of removes as remove does." That should be "remotes"
instead of "removes" there. -- I've made that typo myself
quite often. :)

-- 
Todd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are no stupid questions, but there are a LOT of inquisitive
idiots.
    -- Demotivators (www.despair.com)


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] completion: restore 'remote rm'
  2017-12-29 13:52     ` Todd Zullinger
@ 2017-12-29 16:49       ` Keith Smiley
  2017-12-29 22:48       ` [PATCH] Add shell completion for git remote rm SZEDER Gábor
  1 sibling, 0 replies; 23+ messages in thread
From: Keith Smiley @ 2017-12-29 16:49 UTC (permalink / raw)
  To: Todd Zullinger; +Cc: git, Nguyễn Thái Ngọc Duy, Kevin Daudt

Updated:

e17dba8fe1 ("remote: prefer subcommand name 'remove' to
'rm'", 2012-09-06) removed the 'rm' subcommand from
completion.  The 'remote rm' subcommand is still supported
and not planned to be removed.  Offer completions for it.

Signed-off-by: Keith Smiley <k@keith.so>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 3683c772c5586..3e9044087e6ba 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2665,7 +2665,7 @@ _git_config ()
 _git_remote ()
 {
 	local subcommands="
-		add rename remove set-head set-branches
+		add rename remove rm set-head set-branches
 		get-url set-url show prune update
 		"
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"

--
Keith Smiley

On 12/29, Todd Zullinger wrote:
>Keith Smiley wrote:
>> It looks like that was just about preferring remove in documentation
>> and the like, I think it would still make sense to have both for
>> completion since rm is still supported.
>
>I read it as a first step in a long process to eventually
>remove 'remote rm', but if that's never intended, then sure,
>restoring completion for it seems reasonable.
>
>It would be good to hear from those who know or recall the
>intention.
>
>I think we should only complete the preferred subcommand.
>That encourages use of 'remote remove' even if 'remote rm'
>will stay forever to avoid breaking existing scripts.
>
>If it does make sense to restore completion, adding a link
>back to e17dba8fe1 and explaining why the completion is
>being restored would be good.  Reading the commit message
>now makes it sound like 'remote rm' was never present and is
>being added to correct an oversight.
>
>Maybe something like:
>
>    completion: restore 'remote rm'
>
>    e17dba8fe1 ("remote: prefer subcommand name 'remove' to
>    'rm'", 2012-09-06) removed the 'rm' subcommand from
>    completion.  The 'remote rm' subcommand is still supported
>    and not planned to be removed.  Offer completions for it.
>
>I also noticed that in your original commit that you say
>"list of removes as remove does." That should be "remotes"
>instead of "removes" there. -- I've made that typo myself
>quite often. :)
>
>-- 
>Todd
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>There are no stupid questions, but there are a LOT of inquisitive
>idiots.
>    -- Demotivators (www.despair.com)
>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2017-12-29 13:52     ` Todd Zullinger
  2017-12-29 16:49       ` [PATCH] completion: restore 'remote rm' Keith Smiley
@ 2017-12-29 22:48       ` SZEDER Gábor
  2017-12-29 23:19         ` Keith Smiley
  2017-12-29 23:20         ` Ævar Arnfjörð Bjarmason
  1 sibling, 2 replies; 23+ messages in thread
From: SZEDER Gábor @ 2017-12-29 22:48 UTC (permalink / raw)
  To: Todd Zullinger
  Cc: SZEDER Gábor, Keith Smiley, git,
	Nguyễn Thái Ngọc Duy, Kevin Daudt

> Keith Smiley wrote:
> > It looks like that was just about preferring remove in documentation
> > and the like, I think it would still make sense to have both for
> > completion since rm is still supported.
> 
> I read it as a first step in a long process to eventually
> remove 'remote rm', but if that's never intended, then sure,
> restoring completion for it seems reasonable.
> 
> It would be good to hear from those who know or recall the
> intention.
> 
> I think we should only complete the preferred subcommand.
> That encourages use of 'remote remove' even if 'remote rm'
> will stay forever to avoid breaking existing scripts.

Quoting from the commit message of e17dba8fe1 ("remote: prefer
subcommand name 'remove' to 'rm'", 2012-09-06):

  'rm' is still supported and used in the test suite. It's just not
  widely advertised.

I think adding 'rm' to completion definitely counts as advertisement.
It doesn't have much practical use, after all: typing 'rm' with
completion is actually one more keystroke than without (r<TAB>m vs. rm).


Gábor


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2017-12-29 22:48       ` [PATCH] Add shell completion for git remote rm SZEDER Gábor
@ 2017-12-29 23:19         ` Keith Smiley
  2017-12-29 23:20         ` Ævar Arnfjörð Bjarmason
  1 sibling, 0 replies; 23+ messages in thread
From: Keith Smiley @ 2017-12-29 23:19 UTC (permalink / raw)
  To: SZEDER Gábor
  Cc: Todd Zullinger, git, Nguyễn Thái Ngọc Duy, Kevin Daudt

The goal of this fix isn't to complete rm itself (although that is a 
side effect), it's to complete the remote names after you type rm.

Without this patch doing this:

git remote rm <TAB>

Attempts to complete the options for `git remote` instead of the remote 
names.

--
Keith Smiley

On 12/29, SZEDER Gábor wrote:
>> Keith Smiley wrote:
>> > It looks like that was just about preferring remove in documentation
>> > and the like, I think it would still make sense to have both for
>> > completion since rm is still supported.
>>
>> I read it as a first step in a long process to eventually
>> remove 'remote rm', but if that's never intended, then sure,
>> restoring completion for it seems reasonable.
>>
>> It would be good to hear from those who know or recall the
>> intention.
>>
>> I think we should only complete the preferred subcommand.
>> That encourages use of 'remote remove' even if 'remote rm'
>> will stay forever to avoid breaking existing scripts.
>
>Quoting from the commit message of e17dba8fe1 ("remote: prefer
>subcommand name 'remove' to 'rm'", 2012-09-06):
>
>  'rm' is still supported and used in the test suite. It's just not
>  widely advertised.
>
>I think adding 'rm' to completion definitely counts as advertisement.
>It doesn't have much practical use, after all: typing 'rm' with
>completion is actually one more keystroke than without (r<TAB>m vs. rm).
>
>
>Gábor
>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2017-12-29 22:48       ` [PATCH] Add shell completion for git remote rm SZEDER Gábor
  2017-12-29 23:19         ` Keith Smiley
@ 2017-12-29 23:20         ` Ævar Arnfjörð Bjarmason
  2017-12-30  0:52           ` Todd Zullinger
  1 sibling, 1 reply; 23+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2017-12-29 23:20 UTC (permalink / raw)
  To: SZEDER Gábor
  Cc: Todd Zullinger, Keith Smiley, git,
	Nguyễn Thái Ngọc Duy, Kevin Daudt


On Fri, Dec 29 2017, SZEDER Gábor jotted:

>> Keith Smiley wrote:
>> > It looks like that was just about preferring remove in documentation
>> > and the like, I think it would still make sense to have both for
>> > completion since rm is still supported.
>>
>> I read it as a first step in a long process to eventually
>> remove 'remote rm', but if that's never intended, then sure,
>> restoring completion for it seems reasonable.
>>
>> It would be good to hear from those who know or recall the
>> intention.
>>
>> I think we should only complete the preferred subcommand.
>> That encourages use of 'remote remove' even if 'remote rm'
>> will stay forever to avoid breaking existing scripts.
>
> Quoting from the commit message of e17dba8fe1 ("remote: prefer
> subcommand name 'remove' to 'rm'", 2012-09-06):
>
>   'rm' is still supported and used in the test suite. It's just not
>   widely advertised.

I think we made the wrong choice in standardizing on remove instead of
rm, it should be rm for consistency with git-rm, and "remote rename"
should be "remote mv" etc., just like we have git-mv.

Maybe if we didn't have the Unix legacy we'd pick rename and remove to
be consitent for both, but since that's not going to happen this bit of
inconsistency is worse.

Now with that showing of my biases out of the way...

> I think adding 'rm' to completion definitely counts as advertisement.
> It doesn't have much practical use, after all: typing 'rm' with
> completion is actually one more keystroke than without (r<TAB>m vs. rm).

This is only one use of the completion interface, maybe you only use it
like that, but not everyone does.

The completion interface has two uses, one is to actually save you
typing, the other is subcommand discovery, and maybe someone who has a
use neither you or I have thought of is about to point out a third.

I'll type "git $whatever $subcommand<TAB>" as *validation* that I've
found the right command, not to complete it for me. This is a thing
that's in my muscle memory for everything.

The post-hoc reason is because if you're a fast typist you don't
actually save time on typing the command (usually I just use reverse
shell search anyway), but rather on not screwing up the command itself
via a typo.

Sometimes commands take a while to fail, and even if it's immediate
re-editing them takes longer than getting it right in the first place.

Since I've been typing "git remote rm<TAB>" for a while (started before
this deprecation happened) I've actually been meaning to submit
completion for "rm" since it works, not knowing about Duy's patch until
now.

Now, even if someone disagrees that we should have "rm" at all I think
that in general we should not conflate two different things, one is
whether:

    git remote <TAB>

shows both "rm" and "remove" in the list, and the other is whether:

    git remote rm<TAB>

Should yield:

    git remote rm<SPACE>

Or, as now happens:

    git remote rm<NOTHING AND ÆVAR THINKS IT'S BROKEN>

I can see why we'd, in general, we'd like to not advertise certain
options for completion (due to deprecation, or just to avoid verbosity),
but complete them once they're unambiguously typed out.

I don't know whether the bash completion interface supports making that
distinction, but it would be useful.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2017-12-29 23:20         ` Ævar Arnfjörð Bjarmason
@ 2017-12-30  0:52           ` Todd Zullinger
  2017-12-30 12:19             ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 23+ messages in thread
From: Todd Zullinger @ 2017-12-30  0:52 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: SZEDER Gábor, Keith Smiley, git,
	Nguyễn Thái Ngọc Duy, Kevin Daudt

Ævar Arnfjörð Bjarmason wrote:
>> I think adding 'rm' to completion definitely counts as advertisement.
>> It doesn't have much practical use, after all: typing 'rm' with
>> completion is actually one more keystroke than without (r<TAB>m vs. rm).
> 
> This is only one use of the completion interface, maybe you only use it
> like that, but not everyone does.
> 
> The completion interface has two uses, one is to actually save you
> typing, the other is subcommand discovery, and maybe someone who has a
> use neither you or I have thought of is about to point out a third.
> 
> I'll type "git $whatever $subcommand<TAB>" as *validation* that I've
> found the right command, not to complete it for me. This is a thing
> that's in my muscle memory for everything.

Is that meant to be in favor of including rm in the
completion results or against? :)

> Since I've been typing "git remote rm<TAB>" for a while (started before
> this deprecation happened) I've actually been meaning to submit
> completion for "rm" since it works, not knowing about Duy's patch until
> now.
> 
> Now, even if someone disagrees that we should have "rm" at all I think
> that in general we should not conflate two different things, one is
> whether:
> 
>     git remote <TAB>
> 
> shows both "rm" and "remove" in the list, and the other is whether:
> 
>     git remote rm<TAB>
> 
> Should yield:
> 
>     git remote rm<SPACE>
> 
> Or, as now happens:
> 
>     git remote rm<NOTHING AND ÆVAR THINKS IT'S BROKEN>
> 
> I can see why we'd, in general, we'd like to not advertise certain
> options for completion (due to deprecation, or just to avoid verbosity),
> but complete them once they're unambiguously typed out.
> 
> I don't know whether the bash completion interface supports making that
> distinction, but it would be useful.

It can be done, though I think that it's probably better to
subtly lead people to use 'git remote remove' going forward,
to keep things consistent.  I don't have a strong preference
for or against the rm -> remove change, but since that's
been done I think there's a benefit to keeping things
consistent in the UI.  And I think that should also apply to
not offering completion for commands/subcommands/options
which are only kept for backward compatibility.

Here's one way to make 'git remote rm <TAB>' work without
including it in the output of 'git remote <TAB>':

diff --git i/contrib/completion/git-completion.bash w/contrib/completion/git-completion.bash
index 3683c772c5..aa63f028ab 100644
--- i/contrib/completion/git-completion.bash
+++ w/contrib/completion/git-completion.bash
@@ -2668,7 +2668,9 @@ _git_remote ()
 		add rename remove set-head set-branches
 		get-url set-url show prune update
 		"
-	local subcommand="$(__git_find_on_cmdline "$subcommands")"
+	# Don't advertise rm by including it in subcommands, but complete
+	# remotes if it is used.
+	local subcommand="$(__git_find_on_cmdline "$subcommands rm")"
 	if [ -z "$subcommand" ]; then
 		case "$cur" in
 		--*)

Keeping 'git remote rm' working to avoid breaking scripts is
one thing, but having it in the completion code makes it
more likely that it will continue to be seen as a
recommended subcommand.

This leads to patches like this one, where it's presumed
that the lack of completion is simply an oversight or a bug.
Of course, the lack of completion hasn't caused everyone to
forget that 'remote rm' was changed to 'remote remove', so
that reasoning may be full of hot air (or worse). ;)

The current result of 'git remote rm <TAB>' isn't so great.
It's arguably worse to have it pretend that no subcommand
was given than to list the remotes.

$ git remote rm <TAB>
add            remove         set-head       update
get-url        rename         set-url
prune          set-branches   show

I think completing nothing or completing the remotes
(without offering rm in the subcommand list) would be
better, after looking at it a bit.

I don't know how to disable file completion, but I'm not
intimately familiar with the git completion script (thanks
to it working so damn well).  I'm guessing there's a way to
do that, if there's a strong desire to not complete the
remotes at all.

I don't think we should include rm in 'git remote <TAB>'
completion, but I don't care much either way what 'git
remote rm <TAB>' includes.  But it should be better than
including the other subcommands.

-- 
Todd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There, I've gone and soiled myself, are you happy now?!
    -- Stewie Griffin


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2017-12-30  0:52           ` Todd Zullinger
@ 2017-12-30 12:19             ` Ævar Arnfjörð Bjarmason
  2017-12-31 20:44               ` Keith Smiley
  2018-01-03 19:24               ` Junio C Hamano
  0 siblings, 2 replies; 23+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2017-12-30 12:19 UTC (permalink / raw)
  To: Todd Zullinger
  Cc: SZEDER Gábor, Keith Smiley, git,
	Nguyễn Thái Ngọc Duy, Kevin Daudt


On Sat, Dec 30 2017, Todd Zullinger jotted:

> Ævar Arnfjörð Bjarmason wrote:
>>> I think adding 'rm' to completion definitely counts as advertisement.
>>> It doesn't have much practical use, after all: typing 'rm' with
>>> completion is actually one more keystroke than without (r<TAB>m vs. rm).
>>
>> This is only one use of the completion interface, maybe you only use it
>> like that, but not everyone does.
>>
>> The completion interface has two uses, one is to actually save you
>> typing, the other is subcommand discovery, and maybe someone who has a
>> use neither you or I have thought of is about to point out a third.
>>
>> I'll type "git $whatever $subcommand<TAB>" as *validation* that I've
>> found the right command, not to complete it for me. This is a thing
>> that's in my muscle memory for everything.
>
> Is that meant to be in favor of including rm in the
> completion results or against? :)

For.

>> Since I've been typing "git remote rm<TAB>" for a while (started before
>> this deprecation happened) I've actually been meaning to submit
>> completion for "rm" since it works, not knowing about Duy's patch until
>> now.
>>
>> Now, even if someone disagrees that we should have "rm" at all I think
>> that in general we should not conflate two different things, one is
>> whether:
>>
>>     git remote <TAB>
>>
>> shows both "rm" and "remove" in the list, and the other is whether:
>>
>>     git remote rm<TAB>
>>
>> Should yield:
>>
>>     git remote rm<SPACE>
>>
>> Or, as now happens:
>>
>>     git remote rm<NOTHING AND ÆVAR THINKS IT'S BROKEN>
>>
>> I can see why we'd, in general, we'd like to not advertise certain
>> options for completion (due to deprecation, or just to avoid verbosity),
>> but complete them once they're unambiguously typed out.
>>
>> I don't know whether the bash completion interface supports making that
>> distinction, but it would be useful.
>
> It can be done, though I think that it's probably better to
> subtly lead people to use 'git remote remove' going forward,
> to keep things consistent.  I don't have a strong preference
> for or against the rm -> remove change, but since that's
> been done I think there's a benefit to keeping things
> consistent in the UI.

We changed it in the past, we can always change it again, it's never too
late to fix the UI.

Now whether we *should* change/fix this particular thing is another
matter. I'm just pointing out that we shouldn't fall into the trap of
thinking that git's UI is an established platform that can't be changed.

The vast majority of people who'll ever use git will most likely start
using a version that we're going to release many years into the future.

I'm reminded of the story about the guy who decided makefiles must have
tabs, who didn't want to change it because he already had some dozens of
users.

> And I think that should also apply to
> not offering completion for commands/subcommands/options
> which are only kept for backward compatibility.

Yeah I think it makes sense to at some point stop completing things if
we're going to remove stuff, if we decide to remove it.

> Here's one way to make 'git remote rm <TAB>' work without
> including it in the output of 'git remote <TAB>':
>
> diff --git i/contrib/completion/git-completion.bash w/contrib/completion/git-completion.bash
> index 3683c772c5..aa63f028ab 100644
> --- i/contrib/completion/git-completion.bash
> +++ w/contrib/completion/git-completion.bash
> @@ -2668,7 +2668,9 @@ _git_remote ()
>  		add rename remove set-head set-branches
>  		get-url set-url show prune update
>  		"
> -	local subcommand="$(__git_find_on_cmdline "$subcommands")"
> +	# Don't advertise rm by including it in subcommands, but complete
> +	# remotes if it is used.
> +	local subcommand="$(__git_find_on_cmdline "$subcommands rm")"
>  	if [ -z "$subcommand" ]; then
>  		case "$cur" in
>  		--*)

Neat!

> Keeping 'git remote rm' working to avoid breaking scripts is
> one thing, but having it in the completion code makes it
> more likely that it will continue to be seen as a
> recommended subcommand.
>
> This leads to patches like this one, where it's presumed
> that the lack of completion is simply an oversight or a bug.
> Of course, the lack of completion hasn't caused everyone to
> forget that 'remote rm' was changed to 'remote remove', so
> that reasoning may be full of hot air (or worse). ;)
>
> The current result of 'git remote rm <TAB>' isn't so great.
> It's arguably worse to have it pretend that no subcommand
> was given than to list the remotes.
>
> $ git remote rm <TAB>
> add            remove         set-head       update
> get-url        rename         set-url
> prune          set-branches   show

Although that's a bug that has nothing to do with remove/rm, because you
also get:

    $ git remote blahblah <TAB>
    $ git rebase doesntexist <TAB>

etc. showing you valid subcommands, when perhaps we should show
"warning: no such subcommand `blahblah`/`doesntexist`!" instead.

> I think completing nothing or completing the remotes
> (without offering rm in the subcommand list) would be
> better, after looking at it a bit.
>
> I don't know how to disable file completion, but I'm not
> intimately familiar with the git completion script (thanks
> to it working so damn well).  I'm guessing there's a way to
> do that, if there's a strong desire to not complete the
> remotes at all.
>
> I don't think we should include rm in 'git remote <TAB>'
> completion, but I don't care much either way what 'git
> remote rm <TAB>' includes.  But it should be better than
> including the other subcommands.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2017-12-30 12:19             ` Ævar Arnfjörð Bjarmason
@ 2017-12-31 20:44               ` Keith Smiley
  2018-01-03 19:24               ` Junio C Hamano
  1 sibling, 0 replies; 23+ messages in thread
From: Keith Smiley @ 2017-12-31 20:44 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Todd Zullinger, SZEDER Gábor, git,
	Nguyễn Thái Ngọc Duy, Kevin Daudt

I'm definitely happy to update this patch for now to just complete the 
remote names, and not add rm to the list of subcommand completions if 
we're all ok with that!

--
Keith Smiley

On 12/30, Ævar Arnfjörð Bjarmason wrote:
>
>On Sat, Dec 30 2017, Todd Zullinger jotted:
>
>> Ævar Arnfjörð Bjarmason wrote:
>>>> I think adding 'rm' to completion definitely counts as advertisement.
>>>> It doesn't have much practical use, after all: typing 'rm' with
>>>> completion is actually one more keystroke than without (r<TAB>m vs. rm).
>>>
>>> This is only one use of the completion interface, maybe you only use it
>>> like that, but not everyone does.
>>>
>>> The completion interface has two uses, one is to actually save you
>>> typing, the other is subcommand discovery, and maybe someone who has a
>>> use neither you or I have thought of is about to point out a third.
>>>
>>> I'll type "git $whatever $subcommand<TAB>" as *validation* that I've
>>> found the right command, not to complete it for me. This is a thing
>>> that's in my muscle memory for everything.
>>
>> Is that meant to be in favor of including rm in the
>> completion results or against? :)
>
>For.
>
>>> Since I've been typing "git remote rm<TAB>" for a while (started before
>>> this deprecation happened) I've actually been meaning to submit
>>> completion for "rm" since it works, not knowing about Duy's patch until
>>> now.
>>>
>>> Now, even if someone disagrees that we should have "rm" at all I think
>>> that in general we should not conflate two different things, one is
>>> whether:
>>>
>>>     git remote <TAB>
>>>
>>> shows both "rm" and "remove" in the list, and the other is whether:
>>>
>>>     git remote rm<TAB>
>>>
>>> Should yield:
>>>
>>>     git remote rm<SPACE>
>>>
>>> Or, as now happens:
>>>
>>>     git remote rm<NOTHING AND ÆVAR THINKS IT'S BROKEN>
>>>
>>> I can see why we'd, in general, we'd like to not advertise certain
>>> options for completion (due to deprecation, or just to avoid verbosity),
>>> but complete them once they're unambiguously typed out.
>>>
>>> I don't know whether the bash completion interface supports making that
>>> distinction, but it would be useful.
>>
>> It can be done, though I think that it's probably better to
>> subtly lead people to use 'git remote remove' going forward,
>> to keep things consistent.  I don't have a strong preference
>> for or against the rm -> remove change, but since that's
>> been done I think there's a benefit to keeping things
>> consistent in the UI.
>
>We changed it in the past, we can always change it again, it's never too
>late to fix the UI.
>
>Now whether we *should* change/fix this particular thing is another
>matter. I'm just pointing out that we shouldn't fall into the trap of
>thinking that git's UI is an established platform that can't be changed.
>
>The vast majority of people who'll ever use git will most likely start
>using a version that we're going to release many years into the future.
>
>I'm reminded of the story about the guy who decided makefiles must have
>tabs, who didn't want to change it because he already had some dozens of
>users.
>
>> And I think that should also apply to
>> not offering completion for commands/subcommands/options
>> which are only kept for backward compatibility.
>
>Yeah I think it makes sense to at some point stop completing things if
>we're going to remove stuff, if we decide to remove it.
>
>> Here's one way to make 'git remote rm <TAB>' work without
>> including it in the output of 'git remote <TAB>':
>>
>> diff --git i/contrib/completion/git-completion.bash w/contrib/completion/git-completion.bash
>> index 3683c772c5..aa63f028ab 100644
>> --- i/contrib/completion/git-completion.bash
>> +++ w/contrib/completion/git-completion.bash
>> @@ -2668,7 +2668,9 @@ _git_remote ()
>>  		add rename remove set-head set-branches
>>  		get-url set-url show prune update
>>  		"
>> -	local subcommand="$(__git_find_on_cmdline "$subcommands")"
>> +	# Don't advertise rm by including it in subcommands, but complete
>> +	# remotes if it is used.
>> +	local subcommand="$(__git_find_on_cmdline "$subcommands rm")"
>>  	if [ -z "$subcommand" ]; then
>>  		case "$cur" in
>>  		--*)
>
>Neat!
>
>> Keeping 'git remote rm' working to avoid breaking scripts is
>> one thing, but having it in the completion code makes it
>> more likely that it will continue to be seen as a
>> recommended subcommand.
>>
>> This leads to patches like this one, where it's presumed
>> that the lack of completion is simply an oversight or a bug.
>> Of course, the lack of completion hasn't caused everyone to
>> forget that 'remote rm' was changed to 'remote remove', so
>> that reasoning may be full of hot air (or worse). ;)
>>
>> The current result of 'git remote rm <TAB>' isn't so great.
>> It's arguably worse to have it pretend that no subcommand
>> was given than to list the remotes.
>>
>> $ git remote rm <TAB>
>> add            remove         set-head       update
>> get-url        rename         set-url
>> prune          set-branches   show
>
>Although that's a bug that has nothing to do with remove/rm, because you
>also get:
>
>    $ git remote blahblah <TAB>
>    $ git rebase doesntexist <TAB>
>
>etc. showing you valid subcommands, when perhaps we should show
>"warning: no such subcommand `blahblah`/`doesntexist`!" instead.
>
>> I think completing nothing or completing the remotes
>> (without offering rm in the subcommand list) would be
>> better, after looking at it a bit.
>>
>> I don't know how to disable file completion, but I'm not
>> intimately familiar with the git completion script (thanks
>> to it working so damn well).  I'm guessing there's a way to
>> do that, if there's a strong desire to not complete the
>> remotes at all.
>>
>> I don't think we should include rm in 'git remote <TAB>'
>> completion, but I don't care much either way what 'git
>> remote rm <TAB>' includes.  But it should be better than
>> including the other subcommands.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2017-12-29  4:19   ` Keith Smiley
  2017-12-29 13:52     ` Todd Zullinger
@ 2018-01-01 23:46     ` Duy Nguyen
  1 sibling, 0 replies; 23+ messages in thread
From: Duy Nguyen @ 2018-01-01 23:46 UTC (permalink / raw)
  To: Keith Smiley; +Cc: Todd Zullinger, Git Mailing List

On Fri, Dec 29, 2017 at 11:19 AM, Keith Smiley <k@keith.so> wrote:
> It looks like that was just about preferring remove in documentation and the
> like, I think it would still make sense to have both for completion since rm
> is still supported.

'rm' should be deprecated. But because I did not really push for a
deprecation plan and 'rm' still remains after 5 years, I guess it may
be counted as "supported" too (or we can start the deprecation process
now).

>> Keith Smiley wrote:
>>>
>>> Previously git remote rm did not complete your list of removes as remove
>>> does.
>>
>>
>> Looking through the history, the rm subcomand completion was
>> explicitly removed in e17dba8fe1 ("remote: prefer subcommand
>> name 'remove' to 'rm'", 2012-09-06).
-- 
Duy

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2017-12-30 12:19             ` Ævar Arnfjörð Bjarmason
  2017-12-31 20:44               ` Keith Smiley
@ 2018-01-03 19:24               ` Junio C Hamano
  2018-01-15 21:43                 ` Keith Smiley
  1 sibling, 1 reply; 23+ messages in thread
From: Junio C Hamano @ 2018-01-03 19:24 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Todd Zullinger, SZEDER Gábor, Keith Smiley, git,
	Nguyễn Thái Ngọc Duy, Kevin Daudt

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> On Sat, Dec 30 2017, Todd Zullinger jotted:
>
>> And I think that should also apply to
>> not offering completion for commands/subcommands/options
>> which are only kept for backward compatibility.
>
> Yeah I think it makes sense to at some point stop completing things if
> we're going to remove stuff, if we decide to remove it.
>
>> Here's one way to make 'git remote rm <TAB>' work without
>> including it in the output of 'git remote <TAB>':
>>
>> diff --git i/contrib/completion/git-completion.bash w/contrib/completion/git-completion.bash
>> index 3683c772c5..aa63f028ab 100644
>> --- i/contrib/completion/git-completion.bash
>> +++ w/contrib/completion/git-completion.bash
>> @@ -2668,7 +2668,9 @@ _git_remote ()
>>  		add rename remove set-head set-branches
>>  		get-url set-url show prune update
>>  		"
>> -	local subcommand="$(__git_find_on_cmdline "$subcommands")"
>> +	# Don't advertise rm by including it in subcommands, but complete
>> +	# remotes if it is used.
>> +	local subcommand="$(__git_find_on_cmdline "$subcommands rm")"
>>  	if [ -z "$subcommand" ]; then
>>  		case "$cur" in
>>  		--*)
>
> Neat!

Yes, indeed it is nice.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2018-01-03 19:24               ` Junio C Hamano
@ 2018-01-15 21:43                 ` Keith Smiley
  2018-01-16 10:02                   ` Duy Nguyen
  0 siblings, 1 reply; 23+ messages in thread
From: Keith Smiley @ 2018-01-15 21:43 UTC (permalink / raw)
  To: Junio C Hamano, Ævar Arnfjörð Bjarmason
  Cc: Todd Zullinger, SZEDER Gábor, git,
	Nguyễn Thái Ngọc Duy, Kevin Daudt

So it sounds like either we should deprecate rm, or I should update the patch to the suggested method where we just complete remotes, but not rm in the list of completions.

Thoughts?

-- 
Keith Smiley

On Wed, Jan 3, 2018, at 11:24, Junio C Hamano wrote:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> 
> > On Sat, Dec 30 2017, Todd Zullinger jotted:
> >
> >> And I think that should also apply to
> >> not offering completion for commands/subcommands/options
> >> which are only kept for backward compatibility.
> >
> > Yeah I think it makes sense to at some point stop completing things if
> > we're going to remove stuff, if we decide to remove it.
> >
> >> Here's one way to make 'git remote rm <TAB>' work without
> >> including it in the output of 'git remote <TAB>':
> >>
> >> diff --git i/contrib/completion/git-completion.bash w/contrib/completion/git-completion.bash
> >> index 3683c772c5..aa63f028ab 100644
> >> --- i/contrib/completion/git-completion.bash
> >> +++ w/contrib/completion/git-completion.bash
> >> @@ -2668,7 +2668,9 @@ _git_remote ()
> >>  		add rename remove set-head set-branches
> >>  		get-url set-url show prune update
> >>  		"
> >> -	local subcommand="$(__git_find_on_cmdline "$subcommands")"
> >> +	# Don't advertise rm by including it in subcommands, but complete
> >> +	# remotes if it is used.
> >> +	local subcommand="$(__git_find_on_cmdline "$subcommands rm")"
> >>  	if [ -z "$subcommand" ]; then
> >>  		case "$cur" in
> >>  		--*)
> >
> > Neat!
> 
> Yes, indeed it is nice.
> 
> 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2018-01-15 21:43                 ` Keith Smiley
@ 2018-01-16 10:02                   ` Duy Nguyen
  2018-01-16 18:57                     ` Junio C Hamano
  0 siblings, 1 reply; 23+ messages in thread
From: Duy Nguyen @ 2018-01-16 10:02 UTC (permalink / raw)
  To: Keith Smiley
  Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason,
	Todd Zullinger, SZEDER Gábor, Git Mailing List, Kevin Daudt

On Tue, Jan 16, 2018 at 4:43 AM, Keith Smiley <k@keith.so> wrote:
> So it sounds like either we should deprecate rm, or I should update the patch to the suggested method where we just complete remotes, but not rm in the list of completions.

I vote for deprecation. I could send a patch to start warning to
switch from 'rm' to 'remove'. Then perhaps we can delete it after two
releases. It's not classified as plumbing should we don't have worry
too much about scripts relying on 'remote rm'.

>
> Thoughts?
>
> --
> Keith Smiley
-- 
Duy

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2018-01-16 10:02                   ` Duy Nguyen
@ 2018-01-16 18:57                     ` Junio C Hamano
  2018-01-17  0:44                       ` Duy Nguyen
  0 siblings, 1 reply; 23+ messages in thread
From: Junio C Hamano @ 2018-01-16 18:57 UTC (permalink / raw)
  To: Duy Nguyen
  Cc: Keith Smiley, Ævar Arnfjörð Bjarmason,
	Todd Zullinger, SZEDER Gábor, Git Mailing List, Kevin Daudt

Duy Nguyen <pclouds@gmail.com> writes:

> On Tue, Jan 16, 2018 at 4:43 AM, Keith Smiley <k@keith.so> wrote:
>> So it sounds like either we should deprecate rm, or I should update the patch to the suggested method where we just complete remotes, but not rm in the list of completions.
>
> I vote for deprecation. I could send a patch to start warning to
> switch from 'rm' to 'remove'. Then perhaps we can delete it after two
> releases. It's not classified as plumbing should we don't have worry
> too much about scripts relying on 'remote rm'.

I do not know about "two releases" part (which amounts to merely
20-24 weeks), but looking at "git remote -h" output and seeing that
we do spell out "rename" (instead of saying "mv" or something cryptic),
it probably makes sense to remove "rm" some time in the future.

I actually do think "rm" is _already_ deprecated.  

"git remote --help" does not mention it in its synopsis section and
it merely has ", rm" after "remove" as if an afterthought.  I am not
sure if it is worth being more explicit, perhaps like this?

 Documentation/git-remote.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index 577b969c1b..149db90346 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -93,7 +93,8 @@ the configuration file format.
 'rm'::
 
 Remove the remote named <name>. All remote-tracking branches and
-configuration settings for the remote are removed.
+configuration settings for the remote are removed.  `rm` is a deprecated
+synonym that will be removed in future versions of Git.
 
 'set-head'::
 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2018-01-16 18:57                     ` Junio C Hamano
@ 2018-01-17  0:44                       ` Duy Nguyen
  2018-01-17  6:17                         ` Kevin Daudt
  2018-01-17 18:20                         ` Junio C Hamano
  0 siblings, 2 replies; 23+ messages in thread
From: Duy Nguyen @ 2018-01-17  0:44 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Keith Smiley, Ævar Arnfjörð Bjarmason,
	Todd Zullinger, SZEDER Gábor, Git Mailing List, Kevin Daudt

On Tue, Jan 16, 2018 at 10:57:34AM -0800, Junio C Hamano wrote:
> Duy Nguyen <pclouds@gmail.com> writes:
> 
> > On Tue, Jan 16, 2018 at 4:43 AM, Keith Smiley <k@keith.so> wrote:
> >> So it sounds like either we should deprecate rm, or I should update the patch to the suggested method where we just complete remotes, but not rm in the list of completions.
> >
> > I vote for deprecation. I could send a patch to start warning to
> > switch from 'rm' to 'remove'. Then perhaps we can delete it after two
> > releases. It's not classified as plumbing should we don't have worry
> > too much about scripts relying on 'remote rm'.
> 
> I do not know about "two releases" part (which amounts to merely
> 20-24 weeks), but looking at "git remote -h" output and seeing that
> we do spell out "rename" (instead of saying "mv" or something cryptic),
> it probably makes sense to remove "rm" some time in the future.
> 
> I actually do think "rm" is _already_ deprecated.  
> 
> "git remote --help" does not mention it in its synopsis section and
> it merely has ", rm" after "remove" as if an afterthought.

It's actually my bad. I should have replaced 'rm' with 'remove' in
git-remote.txt in e17dba8fe1 (remote: prefer subcommand name 'remove'
to 'rm' - 2012-09-06)

> I am not sure if it is worth being more explicit, perhaps like this?

Looks good. If we want to be more careful, we can follow up with
something even more annoying like this before removing 'rm'

-- 8< --
diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index 577b969c1b..0a544703e6 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -90,7 +90,6 @@ In case <old> and <new> are the same, and <old> is a file under
 the configuration file format.
 
 'remove'::
-'rm'::
 
 Remove the remote named <name>. All remote-tracking branches and
 configuration settings for the remote are removed.
diff --git a/builtin/remote.c b/builtin/remote.c
index d95bf904c3..774ef6931e 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1609,7 +1609,10 @@ int cmd_remote(int argc, const char **argv, const char *prefix)
 		result = add(argc, argv);
 	else if (!strcmp(argv[0], "rename"))
 		result = mv(argc, argv);
-	else if (!strcmp(argv[0], "rm") || !strcmp(argv[0], "remove"))
+	else if (!strcmp(argv[0], "rm")) {
+		warning(_("'rm' is a deprecated synonym. Use 'remove' instead."));
+		result = rm(argc, argv);
+	} else if (!strcmp(argv[0], "remove"))
 		result = rm(argc, argv);
 	else if (!strcmp(argv[0], "set-head"))
 		result = set_head(argc, argv);
-- 8< --

PS. This also makes me thing about supporting subcommand aliases, so
that people can add back 'git remote rm' if they like (or something
like 'git r rm' when they alias 'remote' as well). Which is probably a
good thing to do. Long command names are fine when you have completion
support, they are a pain to type otherwise.

--
Duy

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2018-01-17  0:44                       ` Duy Nguyen
@ 2018-01-17  6:17                         ` Kevin Daudt
  2018-01-17  9:48                           ` Duy Nguyen
  2018-01-17 18:20                         ` Junio C Hamano
  1 sibling, 1 reply; 23+ messages in thread
From: Kevin Daudt @ 2018-01-17  6:17 UTC (permalink / raw)
  To: Duy Nguyen
  Cc: Junio C Hamano, Keith Smiley,
	Ævar Arnfjörð Bjarmason, Todd Zullinger,
	SZEDER Gábor, Git Mailing List

On Wed, Jan 17, 2018 at 07:44:19AM +0700, Duy Nguyen wrote:
> On Tue, Jan 16, 2018 at 10:57:34AM -0800, Junio C Hamano wrote:
> > Duy Nguyen <pclouds@gmail.com> writes:
> > 
> > > On Tue, Jan 16, 2018 at 4:43 AM, Keith Smiley <k@keith.so> wrote:
> > >> So it sounds like either we should deprecate rm, or I should update the patch to the suggested method where we just complete remotes, but not rm in the list of completions.
> > >
> > > I vote for deprecation. I could send a patch to start warning to
> > > switch from 'rm' to 'remove'. Then perhaps we can delete it after two
> > > releases. It's not classified as plumbing should we don't have worry
> > > too much about scripts relying on 'remote rm'.
> > 
> > I do not know about "two releases" part (which amounts to merely
> > 20-24 weeks), but looking at "git remote -h" output and seeing that
> > we do spell out "rename" (instead of saying "mv" or something cryptic),
> > it probably makes sense to remove "rm" some time in the future.
> > 
> > I actually do think "rm" is _already_ deprecated.  
> > 
> > "git remote --help" does not mention it in its synopsis section and
> > it merely has ", rm" after "remove" as if an afterthought.
> 
> It's actually my bad. I should have replaced 'rm' with 'remove' in
> git-remote.txt in e17dba8fe1 (remote: prefer subcommand name 'remove'
> to 'rm' - 2012-09-06)
> 
> > I am not sure if it is worth being more explicit, perhaps like this?
> 
> Looks good. If we want to be more careful, we can follow up with
> something even more annoying like this before removing 'rm'
> 
> -- 8< --
> diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
> index 577b969c1b..0a544703e6 100644
> --- a/Documentation/git-remote.txt
> +++ b/Documentation/git-remote.txt
> @@ -90,7 +90,6 @@ In case <old> and <new> are the same, and <old> is a file under
>  the configuration file format.
>  
>  'remove'::
> -'rm'::
>  
>  Remove the remote named <name>. All remote-tracking branches and
>  configuration settings for the remote are removed.
> diff --git a/builtin/remote.c b/builtin/remote.c
> index d95bf904c3..774ef6931e 100644
> --- a/builtin/remote.c
> +++ b/builtin/remote.c
> @@ -1609,7 +1609,10 @@ int cmd_remote(int argc, const char **argv, const char *prefix)
>  		result = add(argc, argv);
>  	else if (!strcmp(argv[0], "rename"))
>  		result = mv(argc, argv);
> -	else if (!strcmp(argv[0], "rm") || !strcmp(argv[0], "remove"))
> +	else if (!strcmp(argv[0], "rm")) {
> +		warning(_("'rm' is a deprecated synonym. Use 'remove' instead."));
> +		result = rm(argc, argv);
> +	} else if (!strcmp(argv[0], "remove"))
>  		result = rm(argc, argv);
>  	else if (!strcmp(argv[0], "set-head"))
>  		result = set_head(argc, argv);
> -- 8< --
> 
> PS. This also makes me thing about supporting subcommand aliases, so
> that people can add back 'git remote rm' if they like (or something
> like 'git r rm' when they alias 'remote' as well). Which is probably a
> good thing to do. Long command names are fine when you have completion
> support, they are a pain to type otherwise.
> 

Couldn't they just create an alias like git rrm then, if they use it so
often that it becomes an issue? Having another layer of aliases does
create a lot of complexity.

> --
> Duy

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2018-01-17  6:17                         ` Kevin Daudt
@ 2018-01-17  9:48                           ` Duy Nguyen
  2018-07-16 13:12                             ` Keith Smiley
  0 siblings, 1 reply; 23+ messages in thread
From: Duy Nguyen @ 2018-01-17  9:48 UTC (permalink / raw)
  To: Kevin Daudt
  Cc: Junio C Hamano, Keith Smiley,
	Ævar Arnfjörð Bjarmason, Todd Zullinger,
	SZEDER Gábor, Git Mailing List

On Wed, Jan 17, 2018 at 1:17 PM, Kevin Daudt <me@ikke.info> wrote:
> On Wed, Jan 17, 2018 at 07:44:19AM +0700, Duy Nguyen wrote:
>> PS. This also makes me thing about supporting subcommand aliases, so
>> that people can add back 'git remote rm' if they like (or something
>> like 'git r rm' when they alias 'remote' as well). Which is probably a
>> good thing to do. Long command names are fine when you have completion
>> support, they are a pain to type otherwise.
>>
>
> Couldn't they just create an alias like git rrm then, if they use it so
> often that it becomes an issue?

They could. The only exception that may not work is if they want to
insert some options between "r" and "rm". Sometimes option positions
matter. Anyway this is just thinking out loud, maybe we don't really
need it until people scream about it with a valid use case

> Having another layer of aliases does create a lot of complexity.

Yes. It's partly the reason I wanted this actually ;-) Many commands
have gained subcommands nowadays but there's no shared infrastructure
for managing these subcommands. By adding something that works across
the board at subcommand level I'm forced to "fix" this (or probably
never get to do the sub-aliasing because this "fix" takes forever).
-- 
Duy

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2018-01-17  0:44                       ` Duy Nguyen
  2018-01-17  6:17                         ` Kevin Daudt
@ 2018-01-17 18:20                         ` Junio C Hamano
  1 sibling, 0 replies; 23+ messages in thread
From: Junio C Hamano @ 2018-01-17 18:20 UTC (permalink / raw)
  To: Duy Nguyen
  Cc: Keith Smiley, Ævar Arnfjörð Bjarmason,
	Todd Zullinger, SZEDER Gábor, Git Mailing List, Kevin Daudt

Duy Nguyen <pclouds@gmail.com> writes:

> Looks good. If we want to be more careful, we can follow up with
> something even more annoying like this before removing 'rm'
>
> -- 8< --
> diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
> index 577b969c1b..0a544703e6 100644
> --- a/Documentation/git-remote.txt
> +++ b/Documentation/git-remote.txt
> @@ -90,7 +90,6 @@ In case <old> and <new> are the same, and <old> is a file under
>  the configuration file format.
>  
>  'remove'::
> -'rm'::
>  
>  Remove the remote named <name>. All remote-tracking branches and
>  configuration settings for the remote are removed.
> diff --git a/builtin/remote.c b/builtin/remote.c
> index d95bf904c3..774ef6931e 100644
> --- a/builtin/remote.c
> +++ b/builtin/remote.c
> @@ -1609,7 +1609,10 @@ int cmd_remote(int argc, const char **argv, const char *prefix)
>  		result = add(argc, argv);
>  	else if (!strcmp(argv[0], "rename"))
>  		result = mv(argc, argv);
> -	else if (!strcmp(argv[0], "rm") || !strcmp(argv[0], "remove"))
> +	else if (!strcmp(argv[0], "rm")) {
> +		warning(_("'rm' is a deprecated synonym. Use 'remove' instead."));
> +		result = rm(argc, argv);
> +	} else if (!strcmp(argv[0], "remove"))
>  		result = rm(argc, argv);
>  	else if (!strcmp(argv[0], "set-head"))
>  		result = set_head(argc, argv);
> -- 8< --

Yes, this is a sensible way to properly deprecate it further before
removal.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] Add shell completion for git remote rm
  2018-01-17  9:48                           ` Duy Nguyen
@ 2018-07-16 13:12                             ` Keith Smiley
  0 siblings, 0 replies; 23+ messages in thread
From: Keith Smiley @ 2018-07-16 13:12 UTC (permalink / raw)
  To: Duy Nguyen
  Cc: Kevin Daudt, Junio C Hamano,
	Ævar Arnfjörð Bjarmason, Todd Zullinger,
	SZEDER Gábor, Git Mailing List

Since there hasn't been any movement on the alternative solutions mentioned here, would it be reasonable to accept this patch in the meantime?


--
Keith Smiley

> On Jan 17, 2018, at 01:48, Duy Nguyen <pclouds@gmail.com> wrote:
> 
>> On Wed, Jan 17, 2018 at 1:17 PM, Kevin Daudt <me@ikke.info> wrote:
>>> On Wed, Jan 17, 2018 at 07:44:19AM +0700, Duy Nguyen wrote:
>>> PS. This also makes me thing about supporting subcommand aliases, so
>>> that people can add back 'git remote rm' if they like (or something
>>> like 'git r rm' when they alias 'remote' as well). Which is probably a
>>> good thing to do. Long command names are fine when you have completion
>>> support, they are a pain to type otherwise.
>>> 
>> 
>> Couldn't they just create an alias like git rrm then, if they use it so
>> often that it becomes an issue?
> 
> They could. The only exception that may not work is if they want to
> insert some options between "r" and "rm". Sometimes option positions
> matter. Anyway this is just thinking out loud, maybe we don't really
> need it until people scream about it with a valid use case
> 
>> Having another layer of aliases does create a lot of complexity.
> 
> Yes. It's partly the reason I wanted this actually ;-) Many commands
> have gained subcommands nowadays but there's no shared infrastructure
> for managing these subcommands. By adding something that works across
> the board at subcommand level I'm forced to "fix" this (or probably
> never get to do the sub-aliasing because this "fix" takes forever).
> -- 
> Duy


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2018-07-16 13:21 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-29  2:01 [PATCH] Add shell completion for git remote rm Keith Smiley
2017-12-29  3:29 ` Todd Zullinger
2017-12-29  4:19   ` Keith Smiley
2017-12-29 13:52     ` Todd Zullinger
2017-12-29 16:49       ` [PATCH] completion: restore 'remote rm' Keith Smiley
2017-12-29 22:48       ` [PATCH] Add shell completion for git remote rm SZEDER Gábor
2017-12-29 23:19         ` Keith Smiley
2017-12-29 23:20         ` Ævar Arnfjörð Bjarmason
2017-12-30  0:52           ` Todd Zullinger
2017-12-30 12:19             ` Ævar Arnfjörð Bjarmason
2017-12-31 20:44               ` Keith Smiley
2018-01-03 19:24               ` Junio C Hamano
2018-01-15 21:43                 ` Keith Smiley
2018-01-16 10:02                   ` Duy Nguyen
2018-01-16 18:57                     ` Junio C Hamano
2018-01-17  0:44                       ` Duy Nguyen
2018-01-17  6:17                         ` Kevin Daudt
2018-01-17  9:48                           ` Duy Nguyen
2018-07-16 13:12                             ` Keith Smiley
2018-01-17 18:20                         ` Junio C Hamano
2018-01-01 23:46     ` Duy Nguyen
2017-12-29  6:00 ` Kevin Daudt
2017-12-29  6:21   ` Keith Smiley

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git