Re: [PATCH] completion: add completer for status
On Fri, Jun 28, 2013 at 06:50:02PM +0530, Ramkumar Ramachandra wrote:
Show 13 quoted lines
> SZEDER Gábor wrote:
> > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> > index 912fb988..b68024c6 100644
> > --- a/contrib/completion/git-completion.bash
> > +++ b/contrib/completion/git-completion.bash
> > @@ -1697,6 +1697,8 @@ _git_stage ()
> >
> > _git_status ()
> > {
> > + __git_has_doubledash && return
> > +
>
> This line makes absolutely no sense to me.That was my quick attempt to provide a way to complete untracked files, but M-/ or '--others' will do as well.
> When the case statement
> fails to match anything (which it will, when a double-dash is
> present), we'll use the __git_complete_index_file which is superior to
Show 7 quoted lines
> returning and falling back to the dumb zsh file listing, no? As a
> result, without that line,
>
> $ git status -- foo<TAB>
>
> will complete fine when foo* isn't necessarily a file in the
> filesystem, but something that our ls-files returns, no?
If you want fancy completion replies, then you won't type the doubledash.
Show 12 quoted lines
> > case "$cur" in
> > --untracked-files=*)
> > __gitcomp "no normal all" "" "${cur##--untracked-files=}"
> > @@ -1718,7 +1720,7 @@ _git_status ()
> > return
> > ;;
> > esac
> > - __git_complete_index_file
> > + __git_complete_index_file "--with-tree=HEAD --cached --deleted"
>
> Might as well go all the way with "--cached --deleted --unmerged
> --others" no?'--unmerged' is definitely not good, it implies '--stage', which changes the output format.
> What is the point of --with-tree=HEAD?
To list files that are deleted from the index:
$ rm version.h $ git rm version.c rm 'version.c' $ git ls-files --deleted version.h $ git ls-files --deleted --with-tree=HEAD version.c version.h
Gábor