threads / patch / 16500

patchbash: offer refs instead of filenames for 'git revert'

Subject: [PATCH] bash: offer refs instead of filenames for 'git revert'

## tl;dr

2 messages between Nov 27, 2008 and Nov 27, 2008. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

SZEDER Gábor· Nov 27, 2008, 13:35 UTC · lore

The completion script for 'git revert' currently offers options and filenames. However, 'git revert' doesn't take any filenames from the command line, but a single commit. Therefore, it's more sane to offer refs instead.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to contrib/completion/git-completion.bash +1 −1
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 39bf18b..7e668d5 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1348,7 +1348,7 @@ _git_revert ()
 		return
 		;;
 	esac
-	COMPREPLY=()
+	__gitcomp "$(__git_refs)"
 }
 
 _git_rm ()
-- 
1.6.0.4.814.gfe502
Shawn O. Pearce· Nov 27, 2008, 21:30 UTC · re: SZEDER Gábor · lore

Re: [PATCH] bash: offer refs instead of filenames for 'git revert'

SZEDER GGGbor <szeder@ira.uka.de> wrote:
Show 6 quoted lines
> The completion script for 'git revert' currently offers options and
> filenames.  However, 'git revert' doesn't take any filenames from the
> command line, but a single commit.  Therefore, it's more sane to offer
> refs instead.
> 
> Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Oh, good catch.
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Show 20 quoted lines
> ---
>  contrib/completion/git-completion.bash |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 39bf18b..7e668d5 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1348,7 +1348,7 @@ _git_revert ()
>  		return
>  		;;
>  	esac
> -	COMPREPLY=()
> +	__gitcomp "$(__git_refs)"
>  }
>  
>  _git_rm ()
> -- 
> 1.6.0.4.814.gfe502
> 
-- 
Shawn.

← back to recent threads