threads / patch / 42503

patch, 2 partscompletion: add git status

Subject: [PATCH 2/2] completion: add git status

## tl;dr

3 messages between May 31, 2016 and Jun 1, 2016. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Thomas Braun· May 31, 2016, 23:42 UTC · lore
Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
---
 contrib/completion/git-completion.bash | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
Show changes to contrib/completion/git-completion.bash +28 −0
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 57a0acc..96b7d86 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1782,6 +1782,35 @@ _git_stage ()
 	_git_add
 }
 +_git_status ()
+{
+	case "$cur" in
+	--ignore-submodules=*)
+		__gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}"
+		return
+		;;
+	--untracked-files=*)
+		__gitcomp "$(__git_untracked_file_modes)" "" "${cur##--untracked-files=}"
+		return
+		;;
+	--column=*)
+		__gitcomp "
+			always never auto column row plain dense nodense
+			" "" "${cur##--column=}"
+		return
+		;;
+	--*)
+		__gitcomp "
+			--short --branch --porcelain --long --verbose
+			--untracked-files= --ignore-submodules= --ignored
+			--column= --no-column
+			"
+		return
+		;;
+	esac
+	__git_complete_file
+}
+
 __git_config_get_set_variables ()
 {
 	local prevword word config_file= c=$cword
-- 
2.8.3.windows.1
Jeff King· Jun 1, 2016, 04:07 UTC · re: Thomas Braun · lore

Re: [PATCH 2/2] completion: add git status

On Wed, Jun 01, 2016 at 01:42:18AM +0200, Thomas Braun wrote:
Show 13 quoted lines
> Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
> ---
>  contrib/completion/git-completion.bash | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 57a0acc..96b7d86 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1782,6 +1782,35 @@ _git_stage ()
>  	_git_add
>  }
>  +_git_status ()
This patch has the same funniness as the other. Weird.
Show 8 quoted lines
> +{
> +	case "$cur" in
> +	--ignore-submodules=*)
> +		__gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}"
> +		return
> +		;;
> +	--untracked-files=*)
> +		__gitcomp "$(__git_untracked_file_modes)" "" "${cur##--untracked-files=}"
Same comment on $() here.
Show 19 quoted lines
> +		return
> +		;;
> +	--column=*)
> +		__gitcomp "
> +			always never auto column row plain dense nodense
> +			" "" "${cur##--column=}"
> +		return
> +		;;
> +	--*)
> +		__gitcomp "
> +			--short --branch --porcelain --long --verbose
> +			--untracked-files= --ignore-submodules= --ignored
> +			--column= --no-column
> +			"
> +		return
> +		;;
> +	esac
> +	__git_complete_file
> +}

The rest of it (both the overall goal, and the patch itself) look OK to me.

-Peff
Thomas Braun· Jun 1, 2016, 09:05 UTC · re: Jeff King · lore

Re: [PATCH 2/2] completion: add git status

Show 21 quoted lines
> Jeff King <peff@peff.net> hat am 1. Juni 2016 um 06:07 geschrieben:
> 
> 
> On Wed, Jun 01, 2016 at 01:42:18AM +0200, Thomas Braun wrote:
> 
> > Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
> > ---
> >  contrib/completion/git-completion.bash | 29 +++++++++++++++++++++++++++++
> >  1 file changed, 29 insertions(+)
> > 
> > diff --git a/contrib/completion/git-completion.bash
> > b/contrib/completion/git-completion.bash
> > index 57a0acc..96b7d86 100644
> > --- a/contrib/completion/git-completion.bash
> > +++ b/contrib/completion/git-completion.bash
> > @@ -1782,6 +1782,35 @@ _git_stage ()
> >  	_git_add
> >  }
> >  +_git_status ()
> 
> This patch has the same funniness as the other. Weird.
Should be fixed now.
Show 10 quoted lines
> > +{
> > +	case "$cur" in
> > +	--ignore-submodules=*)
> > +		__gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}"
> > +		return
> > +		;;
> > +	--untracked-files=*)
> > +		__gitcomp "$(__git_untracked_file_modes)" "" "${cur##--untracked-files=}"
> 
> Same comment on $() here.
Fixed.
Show 22 quoted lines
> > +		return
> > +		;;
> > +	--column=*)
> > +		__gitcomp "
> > +			always never auto column row plain dense nodense
> > +			" "" "${cur##--column=}"
> > +		return
> > +		;;
> > +	--*)
> > +		__gitcomp "
> > +			--short --branch --porcelain --long --verbose
> > +			--untracked-files= --ignore-submodules= --ignored
> > +			--column= --no-column
> > +			"
> > +		return
> > +		;;
> > +	esac
> > +	__git_complete_file
> > +}
> 
> The rest of it (both the overall goal, and the patch itself) look OK to
> me.

Thanks, Thomas

← back to recent threads