git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Fabian Wermelinger <fabianw@mavt.ethz.ch>, git@vger.kernel.org
Cc: Fabian Wermelinger <fabianw@mavt.ethz.ch>
Subject: RE: [PATCH] completion: bash: fix late declaration of __git_cmd_idx
Date: Fri, 18 Jun 2021 14:09:58 -0500	[thread overview]
Message-ID: <60ccef865312e_a69392081a@natae.notmuch> (raw)
In-Reply-To: <20210618140256.256481-1-fabianw@mavt.ethz.ch>

Fabian Wermelinger wrote:
> A recent update to contrib/completion/git-completion.bash causes bash to fail
> auto complete custom commands that are wrapped with __git_func_wrap. Declaring
> __git_cmd_idx=0 inside __git_func_wrap resolves the issue.

I was about to say the idx should be 1, and that fixes the issue, but
actually 0 is more correct, since when we do __git_complete there's
actually no real command.

In the future we might want to improve __git_complete to manufacture a
real command since some completions do check the command at
__git_cmd_idx (e.g. __git_complete_remote_or_refspec), and then set
__git_cmd_idx to 1.

But for now your patch fixes the issue better than my previous patch
[1], however, it's still missing the zsh part. I've sent an update patch
with the best of both [2].

Cheers.

[1] https://lore.kernel.org/git/20210618182518.697912-2-felipe.contreras@gmail.com/
[2] https://lore.kernel.org/git/20210618185832.700477-1-felipe.contreras@gmail.com/

Cheers.

-- 
Felipe Contreras

      reply	other threads:[~2021-06-18 19:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18 14:02 [PATCH] completion: bash: fix late declaration of __git_cmd_idx Fabian Wermelinger
2021-06-18 19:09 ` Felipe Contreras [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60ccef865312e_a69392081a@natae.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=fabianw@mavt.ethz.ch \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).