Re: [PATCH v3 2/3] sparse-checkout: custom tab completion
- From
Lessley Dennington <lessleydennington@gmail.com>
- Date
- Jan 18, 2022, 17:56 UTC
- Message-ID
- <ee58a0d5-5773-238d-706f-3fb264b6e8db@gmail.com>
- In-Reply-To
- <xmqq7dayup5d.fsf@gitster.g>
On 1/17/22 11:40 AM, Junio C Hamano wrote:
Show 22 quoted lines
> Elijah Newren <newren@gmail.com> writes: > >> I'm not sure I follow. READM<TAB> already doesn't complete to >> README.md in the following example command lines: >> 'cd READM<TAB>' >> 'ssh READM<TAB>' > > If the example were "ls READM<TAB>", it would have been worth the > time to read and think about this again, but all users expect "cd" > to go into directories, and "ssh" to go visit another host, and > taking a local filename as a hint to complete would be nonsense. > > But that is not what we are talking about (and it is frustrating > that you know it). > > To users, what sparse-checkout takes look like local pathnames, not > necessarily limited to directory names (if you disagree, go back and > read what SZEDER wrote to trigger this thread). > > I know it is your preference to complete only directories and > exclude filenames, but I question if the confusion such a design > causes to end-users is worth it.
I think perhaps we're a little caught up in exemplifying commands that are unrelated to sparse-checkout. As Elijah said in [1], the documentation states that directories and patterns are acceptable to sparse-checkout but not files. While it is not reasonable to try to offer every pattern a user could possibly pass to sparse-checkout, it is reasonable to offer directories and (in my opinion) will help guide users toward correct usage of the command.
However, since completion on directories is cone-mode-specific, I am willing to accept the suggestion to only complete directories if we are in a cone-mode sparse-checkout and apply it in v4 of this series.
[1]: https://lore.kernel.org/git/CABPp-BErg-RtyycXaRXYfQHEQXA4q-FU9Q6nYkSHJsqL-04oXw@mail.gmail.com/