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

2 messages from 2008-11-27 to 2008-11-27. Participants: SZEDER Gábor, Shawn O. Pearce.
Thread: https://gitlist.dev/t/16500

## SZEDER Gábor, 2008-11-27 13:35

Subject: [PATCH] bash: offer refs instead of filenames for 'git revert'
Message-ID: <1227792953-4095-1-git-send-email-szeder@ira.uka.de>
URL: https://gitlist.dev/e/1227792953-4095-1-git-send-email-szeder%40ira.uka.de

```
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(-)

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, 2008-11-27 21:30

Subject: Re: [PATCH] bash: offer refs instead of filenames for 'git revert'
Message-ID: <20081127213012.GC23984@spearce.org>
URL: https://gitlist.dev/e/20081127213012.GC23984%40spearce.org
In-Reply-To: <1227792953-4095-1-git-send-email-szeder@ira.uka.de>

```
SZEDER GGGbor <szeder@ira.uka.de> wrote:
> 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>

> ---
>  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.

```
