threads / patch / 13186

patchcompletion: remove use of dashed git commands

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

## tl;dr

11 messages between Apr 20, 2008 and Apr 20, 2008. Diffs are folded; open one to read it.

replies: 10people: 5as markdown or json

Dan McGee· Apr 20, 2008, 17:28 UTC · lore
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
---
 contrib/completion/git-completion.bash |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Show changes to contrib/completion/git-completion.bash +4 −4
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· Apr 20, 2008, 17:28 UTC · re: Dan McGee · lore

[PATCH] completion: allow 'git remote' subcommand completion

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(-)
Show changes to contrib/completion/git-completion.bash +1 −0
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 O. Pearce· Apr 20, 2008, 19:22 UTC · re: Dan McGee · lore

Re: [PATCH] completion: allow 'git remote' subcommand completion

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.
 
Show 20 quoted lines
> 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· Apr 20, 2008, 19:34 UTC · re: Shawn O. Pearce · lore

[PATCH] completion: allow 'git remote' subcommand completion

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(-)
Show changes to contrib/completion/git-completion.bash +1 −0
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· Apr 20, 2008, 17:43 UTC · re: Dan McGee · lore

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

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· Apr 20, 2008, 17:49 UTC · re: Johannes Schindelin · lore

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

On Sun, Apr 20, 2008 at 12:43 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 9 quoted lines
> 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.)

Johannes Schindelin· Apr 20, 2008, 17:54 UTC · re: Dan McGee · lore

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

Hi,
On Sun, 20 Apr 2008, Dan McGee wrote:
Show 13 quoted lines
> 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· Apr 20, 2008, 17:58 UTC · re: Johannes Schindelin · lore

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

On Sun, Apr 20, 2008 at 12:54 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 22 quoted lines
> 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· Apr 20, 2008, 18:53 UTC · re: Johannes Schindelin · lore

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

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
Junio C Hamano· Apr 20, 2008, 17:51 UTC · re: Johannes Schindelin · lore

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

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 9 quoted lines
> 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...

Shawn O. Pearce· Apr 20, 2008, 19:20 UTC · re: Dan McGee · lore

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

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.
 
Show 43 quoted lines
> 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.

← back to recent threads