]> git.ipfire.org Git - thirdparty/git.git/commit
completion: avoid misleading completions in cone mode
authorElijah Newren <newren@gmail.com>
Sun, 3 Dec 2023 05:57:03 +0000 (05:57 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 Dec 2023 06:25:14 +0000 (15:25 +0900)
commit7c3595b6132c048916df77107ef87f8d3b4f9a42
treef04cddad29901e2bcde088f12e87567e277dedfd
parent253eeaf7a2bc93285b55e2be8aa15f27cd11858e
completion: avoid misleading completions in cone mode

The "set" and "add" subcommands of "sparse-checkout", when in cone mode,
should only complete on directories.  For bash_completion in general,
when no completions are returned for any subcommands, it will often fall
back to standard completion of files and directories as a substitute.
That is not helpful here.  Since we have already looked for all valid
completions, if none are found then falling back to standard bash file
and directory completion is at best actively misleading.  In fact, there
are three different ways it can be actively misleading.  Add a long
comment in the code about how that fallback behavior can deceive, and
disable the fallback by returning a fake result as the sole completion.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash