completion: handle unusual characters for sparse-checkout
commit48803821b1712687d6e06e9d7a0e911eabecf4d1
authorLessley Dennington <lessleydennington@gmail.com>
Mon, 7 Feb 2022 17:31:45 +0000 (7 17:31 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 Feb 2022 18:15:43 +0000 (8 10:15 -0800)
treec27ef270183a0ee6f2cf5953c1933cdf5c5bb34c
parentc5f5c5082f813a875c213445135a24c2507021dd
completion: handle unusual characters for sparse-checkout

Update the __gitcomp_directories method to de-quote and handle unusual
characters in directory names. Although this initially involved an attempt
to re-use the logic in __git_index_files, this method removed
subdirectories (e.g. folder1/0/ became folder1/), so instead new custom
logic was placed directly in the __gitcomp_directories method.

Note there are two tests for this new functionality - one for spaces and
accents and one for backslashes and tabs. The backslashes and tabs test
uses FUNNYNAMES to avoid running on Windows. This is because:

1. Backslashes are explicitly not allowed in Windows file paths.
2. Although tabs appear to be allowed when creating a file in a Windows
bash shell, they actually are not renderable (and appear as empty boxes
in the shell).

Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Co-authored-by: Lessley Dennington <lessleydennington@gmail.com>
Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Lessley Dennington <lessleydennington@gmail.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash
t/t9902-completion.sh