# [PATCH] completion: remove use of dashed git commands

11 messages from 2008-04-20 to 2008-04-20. Participants: Dan McGee, Johannes Schindelin, Junio C Hamano, Matthieu Moy, Shawn O. Pearce.
Thread: https://gitlist.dev/t/13186

## Dan McGee, 2008-04-20 17:28

Subject: [PATCH] completion: remove use of dashed git commands
Message-ID: <1208712525-1747-1-git-send-email-dpmcgee@gmail.com>
URL: https://gitlist.dev/e/1208712525-1747-1-git-send-email-dpmcgee%40gmail.com

```
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
---
 contrib/completion/git-completion.bash |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 4d81963..3f78630 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -152,7 +152,7 @@ __git_heads ()
 		done
 		return
 	fi
-	for i in $(git-ls-remote "$1" 2>/dev/null); do
+	for i in $(git ls-remote "$1" 2>/dev/null); do
 		case "$is_hash,$i" in
 		y,*) is_hash=n ;;
 		n,*^{}) is_hash=y ;;
@@ -173,7 +173,7 @@ __git_tags ()
 		done
 		return
 	fi
-	for i in $(git-ls-remote "$1" 2>/dev/null); do
+	for i in $(git ls-remote "$1" 2>/dev/null); do
 		case "$is_hash,$i" in
 		y,*) is_hash=n ;;
 		n,*^{}) is_hash=y ;;
@@ -200,7 +200,7 @@ __git_refs ()
 		done
 		return
 	fi
-	for i in $(git-ls-remote "$dir" 2>/dev/null); do
+	for i in $(git ls-remote "$dir" 2>/dev/null); do
 		case "$is_hash,$i" in
 		y,*) is_hash=n ;;
 		n,*^{}) is_hash=y ;;
@@ -223,7 +223,7 @@ __git_refs2 ()
 __git_refs_remotes ()
 {
 	local cmd i is_hash=y
-	for i in $(git-ls-remote "$1" 2>/dev/null); do
+	for i in $(git ls-remote "$1" 2>/dev/null); do
 		case "$is_hash,$i" in
 		n,refs/heads/*)
 			is_hash=y
-- 
1.5.5

```

## Dan McGee, 2008-04-20 17:28

Subject: [PATCH] completion: allow 'git remote' subcommand completion
Message-ID: <1208712525-1747-2-git-send-email-dpmcgee@gmail.com>
URL: https://gitlist.dev/e/1208712525-1747-2-git-send-email-dpmcgee%40gmail.com
In-Reply-To: <1208712525-1747-1-git-send-email-dpmcgee@gmail.com>

```
After typing 'git prune ', the subcommand options were not shown. Fix it.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
---
 contrib/completion/git-completion.bash |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 3f78630..6012047 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1052,6 +1052,7 @@ _git_remote ()
 	local subcommands="add rm show prune update"
 	local subcommand="$(__git_find_subcommand "$subcommands")"
 	if [ -z "$subcommand" ]; then
+		__gitcomp "$subcommands"
 		return
 	fi
 
-- 
1.5.5

```

## Johannes Schindelin, 2008-04-20 17:43

Subject: Re: [PATCH] completion: remove use of dashed git commands
Message-ID: <alpine.DEB.1.00.0804201841570.5084@eeepc-johanness>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0804201841570.5084%40eeepc-johanness
In-Reply-To: <1208712525-1747-1-git-send-email-dpmcgee@gmail.com>

```
Hi,

On Sun, 20 Apr 2008, Dan McGee wrote:

> [no commit message]

I would like to deprecate dashed form _officially_ first (as in 
ReleaseNotes), before doing something that could lead to quite some 
surprised users.

Ciao,
Dscho

```

## Dan McGee, 2008-04-20 17:49

Subject: Re: [PATCH] completion: remove use of dashed git commands
Message-ID: <449c10960804201049o1c8f0be4m36dc5ce2afec2de6@mail.gmail.com>
URL: https://gitlist.dev/e/449c10960804201049o1c8f0be4m36dc5ce2afec2de6%40mail.gmail.com
In-Reply-To: <alpine.DEB.1.00.0804201841570.5084@eeepc-johanness>

```
On Sun, Apr 20, 2008 at 12:43 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
>  On Sun, 20 Apr 2008, Dan McGee wrote:
>
>  > [no commit message]
>
>  I would like to deprecate dashed form _officially_ first (as in
>  ReleaseNotes), before doing something that could lead to quite some
>  surprised users.

Now you've confused me. From Documentation/RelNotes-1.5.4.txt, it
seems fairly clear that dashed command forms are deprecated.

This patch was rather non-intrusive- it only updated the bash
completion script to use the non-dashed forms. I'm not sure how this
leads to surprised users at all.

-Dan

(Sorry for the double send, forgot the reply-all the first time. Looks
like I need another Sunday cup of coffee.)

```

## Junio C Hamano, 2008-04-20 17:51

Subject: Re: [PATCH] completion: remove use of dashed git commands
Message-ID: <7vskxgbejn.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vskxgbejn.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <alpine.DEB.1.00.0804201841570.5084@eeepc-johanness>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Hi,
>
> On Sun, 20 Apr 2008, Dan McGee wrote:
>
>> [no commit message]
>
> I would like to deprecate dashed form _officially_ first (as in 
> ReleaseNotes), before doing something that could lead to quite some 
> surprised users.

I'd share your distaste against an empty log message to justify the
changes, but I do not see where those "quite some surprised users" would
come from.

At least people know "git foo" form is and has been supported, so if
somebody changes "git-ls-files" to "git ls-files", nobody would go "gee, I
did not know I can write it without dash" these days...

```

## Johannes Schindelin, 2008-04-20 17:54

Subject: Re: [PATCH] completion: remove use of dashed git commands
Message-ID: <alpine.DEB.1.00.0804201853150.5084@eeepc-johanness>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0804201853150.5084%40eeepc-johanness
In-Reply-To: <449c10960804201049o1c8f0be4m36dc5ce2afec2de6@mail.gmail.com>

```
Hi,

On Sun, 20 Apr 2008, Dan McGee wrote:

> On Sun, Apr 20, 2008 at 12:43 PM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
>
> >  On Sun, 20 Apr 2008, Dan McGee wrote:
> >
> >  > [no commit message]
> >
> >  I would like to deprecate dashed form _officially_ first (as in 
> >  ReleaseNotes), before doing something that could lead to quite some 
> >  surprised users.
> 
> Now you've confused me. From Documentation/RelNotes-1.5.4.txt, it
> seems fairly clear that dashed command forms are deprecated.

Oh, I must have missed that.  Nevertheless, I think it should be 
synchronised with when the dashed commands vanish from the default 
installation.

Ciao,
Dscho

```

## Dan McGee, 2008-04-20 17:58

Subject: Re: [PATCH] completion: remove use of dashed git commands
Message-ID: <449c10960804201058h7322590eg9864be2c652b0091@mail.gmail.com>
URL: https://gitlist.dev/e/449c10960804201058h7322590eg9864be2c652b0091%40mail.gmail.com
In-Reply-To: <alpine.DEB.1.00.0804201853150.5084@eeepc-johanness>

```
On Sun, Apr 20, 2008 at 12:54 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
>  On Sun, 20 Apr 2008, Dan McGee wrote:
>
>  > On Sun, Apr 20, 2008 at 12:43 PM, Johannes Schindelin
>  > <Johannes.Schindelin@gmx.de> wrote:
>  >
>
> > >  On Sun, 20 Apr 2008, Dan McGee wrote:
>  > >
>  > >  > [no commit message]
>  > >
>  > >  I would like to deprecate dashed form _officially_ first (as in
>  > >  ReleaseNotes), before doing something that could lead to quite some
>  > >  surprised users.
>  >
>  > Now you've confused me. From Documentation/RelNotes-1.5.4.txt, it
>  > seems fairly clear that dashed command forms are deprecated.
>
>  Oh, I must have missed that.  Nevertheless, I think it should be
>  synchronised with when the dashed commands vanish from the default
>  installation.

>From the RelNotes:
   Users are strongly encouraged to adjust their habits and scripts now
   to prepare for this change.

It seems like setting a good example would be prudent, so I attempted
to do that here. If adding a commit message referencing the
documentation would have helped, then I'm sorry for that, but I've
submitted patches like this in the past (22fa97) without near as much
hassle as I'm getting for this small change.

-Dan

```

## Matthieu Moy, 2008-04-20 18:53

Subject: Re: [PATCH] completion: remove use of dashed git commands
Message-ID: <vpqwsmstl1u.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqwsmstl1u.fsf%40bauges.imag.fr
In-Reply-To: <alpine.DEB.1.00.0804201853150.5084@eeepc-johanness>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Oh, I must have missed that.  Nevertheless, I think it should be 
> synchronised with when the dashed commands vanish from the default 
> installation.

I think you missed the point of the patch.

It removes _uses_ of dashed-form in the completion script, but doesn't
remove completion for dashed forms. That could be made clear in the
commit message to avoid confusion.

-- 
Matthieu

```

## Shawn O. Pearce, 2008-04-20 19:20

Subject: Re: [PATCH] completion: remove use of dashed git commands
Message-ID: <20080420192054.GH29771@spearce.org>
URL: https://gitlist.dev/e/20080420192054.GH29771%40spearce.org
In-Reply-To: <1208712525-1747-1-git-send-email-dpmcgee@gmail.com>

```
Dan McGee <dpmcgee@gmail.com> wrote:
> Signed-off-by: Dan McGee <dpmcgee@gmail.com>
> ---
>  contrib/completion/git-completion.bash |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)

Acked-by: Shawn O. Pearce <spearce@spearce.org>

Despite Dscho's remarks, this is a change that is harmless and
should be happening before we officially remove the dashed forms
from the user's path.
 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 4d81963..3f78630 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -152,7 +152,7 @@ __git_heads ()
>  		done
>  		return
>  	fi
> -	for i in $(git-ls-remote "$1" 2>/dev/null); do
> +	for i in $(git ls-remote "$1" 2>/dev/null); do
>  		case "$is_hash,$i" in
>  		y,*) is_hash=n ;;
>  		n,*^{}) is_hash=y ;;
> @@ -173,7 +173,7 @@ __git_tags ()
>  		done
>  		return
>  	fi
> -	for i in $(git-ls-remote "$1" 2>/dev/null); do
> +	for i in $(git ls-remote "$1" 2>/dev/null); do
>  		case "$is_hash,$i" in
>  		y,*) is_hash=n ;;
>  		n,*^{}) is_hash=y ;;
> @@ -200,7 +200,7 @@ __git_refs ()
>  		done
>  		return
>  	fi
> -	for i in $(git-ls-remote "$dir" 2>/dev/null); do
> +	for i in $(git ls-remote "$dir" 2>/dev/null); do
>  		case "$is_hash,$i" in
>  		y,*) is_hash=n ;;
>  		n,*^{}) is_hash=y ;;
> @@ -223,7 +223,7 @@ __git_refs2 ()
>  __git_refs_remotes ()
>  {
>  	local cmd i is_hash=y
> -	for i in $(git-ls-remote "$1" 2>/dev/null); do
> +	for i in $(git ls-remote "$1" 2>/dev/null); do
>  		case "$is_hash,$i" in
>  		n,refs/heads/*)
>  			is_hash=y
> -- 
> 1.5.5
> 

-- 
Shawn.

```

## Shawn O. Pearce, 2008-04-20 19:22

Subject: Re: [PATCH] completion: allow 'git remote' subcommand completion
Message-ID: <20080420192259.GI29771@spearce.org>
URL: https://gitlist.dev/e/20080420192259.GI29771%40spearce.org
In-Reply-To: <1208712525-1747-2-git-send-email-dpmcgee@gmail.com>

```
Dan McGee <dpmcgee@gmail.com> wrote:
> After typing 'git prune ', the subcommand options were not shown. Fix it.

That's not really what this change does.  It fixes the subcommands
for 'git remote ', which were broken without this __gitcomp call
in this location.

Acked-by: Shawn O. Pearce <spearce@spearce.org>

but I'd like to see a more accurate commit message for this fix.
 
> Signed-off-by: Dan McGee <dpmcgee@gmail.com>
> ---
>  contrib/completion/git-completion.bash |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 3f78630..6012047 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1052,6 +1052,7 @@ _git_remote ()
>  	local subcommands="add rm show prune update"
>  	local subcommand="$(__git_find_subcommand "$subcommands")"
>  	if [ -z "$subcommand" ]; then
> +		__gitcomp "$subcommands"
>  		return
>  	fi
>  
> -- 
> 1.5.5
> 

-- 
Shawn.

```

## Dan McGee, 2008-04-20 19:34

Subject: [PATCH] completion: allow 'git remote' subcommand completion
Message-ID: <1208720047-5200-1-git-send-email-dpmcgee@gmail.com>
URL: https://gitlist.dev/e/1208720047-5200-1-git-send-email-dpmcgee%40gmail.com
In-Reply-To: <20080420192259.GI29771@spearce.org>

```
After typing 'git remote ', the subcommand options were not shown. Fix it
by adding the missing __gitcomp call.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
---

Resubmit per Shawn's comments- duh. I was just thinking backwards since
remote has a prune subcommand.

 contrib/completion/git-completion.bash |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 3f78630..6012047 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1052,6 +1052,7 @@ _git_remote ()
 	local subcommands="add rm show prune update"
 	local subcommand="$(__git_find_subcommand "$subcommands")"
 	if [ -z "$subcommand" ]; then
+		__gitcomp "$subcommands"
 		return
 	fi
 
-- 
1.5.5

```
