git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] completion: include PARSE_OPT_HIDDEN in completion output

From
Duy Nguyen <pclouds@gmail.com>
Date
Aug 17, 2018, 14:47 UTC
Message-ID
<CACsJy8AtoftZL7dKCL2qpKvGHHcSXKj057CU3aCACUqUMgMp-g@mail.gmail.com>
In-Reply-To
<20180816151125.11803-1-avarab@gmail.com>

On Thu, Aug 16, 2018 at 8:42 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 26 quoted lines
>
> The PARSE_OPT_HIDDEN is, per the documentation of the "option" struct
> in option parse-options.h, only supposed to affect -h output, not
> completion. That's what the PARSE_OPT_NOCOMPLETE flag is supposed to
> be for.
>
> Since 2e29dca66a ("completion: use __gitcomp_builtin in _git_commit",
> 2018-02-09) we've been using e.g. "git commit --git-completion-helper"
> to get the bash completion for the git-commit command. Due to
> PARSE_OPT_HIDDEN this excluded e.g. --allow-empty and
> --allow-empty-message.
>
> Now, this wasn't a behavior change in that commit. Before that we had
> a hardcoded list of options, removed in 2e29dca66a ("completion: use
> __gitcomp_builtin in _git_commit", 2018-02-09). This list didn't
> contain those two options.
>
> But as noted in the follow-up discussion to c9b5fde759 ("Add option to
> git-commit to allow empty log messages", 2010-04-06) in
> https://public-inbox.org/git/20100406055530.GE3901@coredump.intra.peff.net/
> the motivation for PARSE_OPT_HIDDEN was to keep the "git commit -h"
> output to a minimum, not to hide it from completion.
>
> I think it makes sense to exclude options like these from -h output,
> but for the completion the user is usually not trying to complete "git
> commit --<TAB>",
Actually I do :)
> but e.g. "git commit --allo<TAB>", and because of this behavior we don't show these options at all there.

And it would be great if these options do not show up at --<tab> but do when with --a<tab>.

We already do something similar to this with --no-<tab>. So this could be another option.

-- 
Duy
Previous: Junio C Hamano
Message 5 of 5 in “Incomplete bash completion on git commit: --allow-empty-message and --allow-empty”
  1. Hadi SafariAug 16, 2018
  2. Duy NguyenAug 16, 2018
  3. completion: include PARSE_OPT_HIDDEN in completion outputÆvar Arnfjörð Bjarmason, Aug 16, 2018
  4. Junio C HamanoAug 16, 2018
  5. Duy NguyenAug 17, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.