From: "Florian Gamböck" <mail@floga.de>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: Git mailing list <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Stefan Beller <sbeller@google.com>
Subject: Re: [PATCH v2 1/1] completion: load completion file for external subcommand
Date: Sun, 29 Apr 2018 16:09:20 +0200 [thread overview]
Message-ID: <20180429140920.GA570@furore> (raw)
In-Reply-To: <CAM0VKjkmQObwiUBnf+xydKS1rO5B20HdWsdBjsQLDhcndoM7ng@mail.gmail.com>
On 2018-04-29 15:08, SZEDER Gábor wrote:
> On Sun, Apr 29, 2018 at 1:15 PM, Florian Gamböck <mail@floga.de>
> wrote:
>> I sense a problem here. If I have a directory with a file xyzfoobar
>> in it, and I type `git xyz`, with no defined subcommand that starts
>> with these letters, then minimal bashcomp would give me `git
>> xyzfoobar`, which can of course not execute. This can be unintuitive
>> for users, as in: "If it can't be executed correctly, then why does
>> it even suggest such a completion?"
>
> I'm not sure I understand the problem. After 'git xyz<TAB>' (note
> there is no space between 'xyz' and <TAB>) we try to complete the name
> of a git command, not options of a git command. This means:
>
> - At this point we don't look for a _git_xyz() function, so we'll
> return from __git_main() before even reaching the piece of code your
> patch modifies.
>
> - There are (presumably) no commands starting with 'xyz', so we don't
> list any commands. Bash will then fall back to its own filename
> completion, and that's where that 'xyzfoobar' will come from. It has
> been behaving like this basically since forever.
>
> And after 'git xyz <TAB>' (this time with space) we already complete
> the next word, not 'xyz'.
You are absolutely right! I don't know what my brain was making up here,
I am sorry. The minimal completion will come up regardless if no valid
completion can be found. I think I mixed up the meaning of $cword in
__git_main. It is correct, if I want to complete `git xyz<TAB>`, then my
patch is never reached.
>>> I think all you need to do is run a
>>> s/__load_completion/_completion_loader/ on your patch and update the
>>> commit message with relevant bits from the above discussion.
>>
>> I can do that, no problem. But prior to that I want to be sure that
>> you are okay with the above mentioned drawback. Will the behavior be
>> acceptable in this case? Or should we try to somehow "undo" the
>> minimal completion afterwards?
>
> As explained above, I don't think there is any drawback here. Or at
> least not any new drawback that your patch is introducing. Or I'm
> completely missing your point; certainly a possibility, it's early
> Sunday afternoon, after all :)
Okay, then I'll prepare the next round. Thank you very much for your
helpful feedback!
prev parent reply other threads:[~2018-04-29 14:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-10 20:28 [PATCH v2 0/1] completion: dynamic completion loading Florian Gamböck
2018-04-10 20:28 ` [PATCH v2 1/1] completion: load completion file for external subcommand Florian Gamböck
2018-04-18 19:51 ` SZEDER Gábor
2018-04-19 19:07 ` Florian Gamböck
2018-04-23 15:12 ` SZEDER Gábor
2018-04-23 17:32 ` Florian Gamböck
2018-04-25 14:40 ` SZEDER Gábor
2018-04-29 11:15 ` Florian Gamböck
2018-04-29 13:08 ` SZEDER Gábor
2018-04-29 14:09 ` Florian Gamböck [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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180429140920.GA570@furore \
--to=mail@floga.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sbeller@google.com \
--cc=szeder.dev@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).