# [PATCH] bash completion: Add long options for 'git describe'

6 messages from 2008-07-25 to 2008-07-26. Participants: Thomas Rast, SZEDER Gábor, Shawn O. Pearce.
Thread: https://gitlist.dev/t/14670

## Thomas Rast, 2008-07-25 10:02

Subject: [PATCH] bash completion: Add long options for 'git describe'
Message-ID: <1216980170-14136-1-git-send-email-trast@student.ethz.ch>
URL: https://gitlist.dev/e/1216980170-14136-1-git-send-email-trast%40student.ethz.ch

```
---

It seemed so tedious to type --always so I wrote this instead ;-)

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

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 3b04934..421431c 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -665,6 +665,17 @@ _git_commit ()
 
 _git_describe ()
 {
+	__git_has_doubledash && return
+
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+	case "$cur" in
+	--*)
+		__gitcomp "
+			--all --tags --contains --abbrev= --candidates=
+			--exact-match --debug --long --match --always
+			"
+		return
+	esac
 	__gitcomp "$(__git_refs)"
 }
 
-- 
1.6.0.rc0.48.g3fa0a

```

## SZEDER Gábor, 2008-07-25 13:15

Subject: Re: [PATCH] bash completion: Add long options for 'git describe'
Message-ID: <20080725131532.GB6701@neumann>
URL: https://gitlist.dev/e/20080725131532.GB6701%40neumann
In-Reply-To: <1216980170-14136-1-git-send-email-trast@student.ethz.ch>

```
Hi,

On Fri, Jul 25, 2008 at 12:02:50PM +0200, Thomas Rast wrote:
> ---
Signed off by?

>  _git_describe ()
>  {
> +	__git_has_doubledash && return
This line is superfluous, because 'git describe' does not have any path
arguments.

Gábor

```

## Shawn O. Pearce, 2008-07-25 16:20

Subject: Re: [PATCH] bash completion: Add long options for 'git describe'
Message-ID: <20080725162028.GB21117@spearce.org>
URL: https://gitlist.dev/e/20080725162028.GB21117%40spearce.org
In-Reply-To: <20080725131532.GB6701@neumann>

```
SZEDER GGGbor <szeder@ira.uka.de> wrote:
> On Fri, Jul 25, 2008 at 12:02:50PM +0200, Thomas Rast wrote:
> > ---
> Signed off by?
> 
> >  _git_describe ()
> >  {
> > +	__git_has_doubledash && return
> This line is superfluous, because 'git describe' does not have any path
> arguments.

Yup.  Aside from the two items described above (mising SOB line
and the unnecessary double dash test) this patch looks fine.

-- 
Shawn.

```

## Thomas Rast, 2008-07-26 10:25

Subject: Re: [PATCH] bash completion: Add long options for 'git describe'
Message-ID: <200807261225.13949.trast@student.ethz.ch>
URL: https://gitlist.dev/e/200807261225.13949.trast%40student.ethz.ch
In-Reply-To: <20080725162028.GB21117@spearce.org>

```
Shawn O. Pearce wrote:
> SZEDER GGGbor <szeder@ira.uka.de> wrote:
> > >  _git_describe ()
> > >  {
> > > +	__git_has_doubledash && return
> > This line is superfluous, because 'git describe' does not have any path
> > arguments.
> 
> Yup.  Aside from the two items described above (mising SOB line
> and the unnecessary double dash test) this patch looks fine.

I suppose you're right.  It does (empirically) attempt to parse
anything following a -- as a revision argument, but similar commands
like cherry-pick don't handle the -- specially either.

I'll resend a fixed version.

- Thomas

-- 
Thomas Rast
trast@student.ethz.ch


```

## Thomas Rast, 2008-07-26 10:26

Subject: [PATCH] bash completion: Add long options for 'git describe'
Message-ID: <1217068016-10954-1-git-send-email-trast@student.ethz.ch>
URL: https://gitlist.dev/e/1217068016-10954-1-git-send-email-trast%40student.ethz.ch
In-Reply-To: <20080725162028.GB21117@spearce.org>

```
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 contrib/completion/git-completion.bash |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 3b04934..4ae8b36 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -665,6 +665,15 @@ _git_commit ()
 
 _git_describe ()
 {
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+	case "$cur" in
+	--*)
+		__gitcomp "
+			--all --tags --contains --abbrev= --candidates=
+			--exact-match --debug --long --match --always
+			"
+		return
+	esac
 	__gitcomp "$(__git_refs)"
 }
 
-- 
1.6.0.rc0.50.g6a66e

```

## Shawn O. Pearce, 2008-07-26 21:52

Subject: Re: [PATCH] bash completion: Add long options for 'git describe'
Message-ID: <20080726215210.GC16219@spearce.org>
URL: https://gitlist.dev/e/20080726215210.GC16219%40spearce.org
In-Reply-To: <1217068016-10954-1-git-send-email-trast@student.ethz.ch>

```
Thomas Rast <trast@student.ethz.ch> wrote:
> Signed-off-by: Thomas Rast <trast@student.ethz.ch>

Much shorter, thanks.

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

> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 3b04934..4ae8b36 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -665,6 +665,15 @@ _git_commit ()
>  
>  _git_describe ()
>  {
> +	local cur="${COMP_WORDS[COMP_CWORD]}"
> +	case "$cur" in
> +	--*)
> +		__gitcomp "
> +			--all --tags --contains --abbrev= --candidates=
> +			--exact-match --debug --long --match --always
> +			"
> +		return
> +	esac
>  	__gitcomp "$(__git_refs)"
>  }
>  

-- 
Shawn.

```
