Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] _git: Complete files after 'reset' when there are no commits, when the 'verbose' style is set.

Oliver Kiddle wrote on Sun, 06 Aug 2017 00:11 +0200:
> On 31 Jul, Daniel Shahaf wrote:
> > +++ b/Completion/Unix/Command/_git
> > @@ -1462,6 +1462,12 @@ _git-reset () {
> >    case $state in
> >      (file)
> >        local tree=HEAD
> > +      if zstyle -t :completion:${curcontext}: verbose; then
> > +        if ! _call_program headed git rev-parse --verify HEAD 2>/dev/null; then
> Was this supposed to assign the output of git rev-parse to $tree

No, it was not.  I wanted to check whether HEAD refers to a commit, and
for that, only the command's exit value matters.

> because this is currently spewing the hash into the terminal?

The code would be correct either with the assignment you implemented, or
with additionally redirecting stdout to /dev/null.

> Note _call_program should do the stderr redirection for you.

*nod*.  I didn't test without the 2>/dev/null redirection.

> Patch below does this and adds a few new options for git 2.14.

Thanks for fixing.



Messages sorted by: Reverse Date, Date, Thread, Author