diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2018-04-17 00:41:08 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-04-17 12:49:36 +0900 |
commit | 3dfe23ba51664467d89ba937e607ffef6501c3f3 (patch) | |
tree | 2c468eeab3f1d6477045eda560b595d853939ab7 /contrib/completion | |
parent | completion: simplify prefix path component handling during path completion (diff) | |
download | tgif-3dfe23ba51664467d89ba937e607ffef6501c3f3.tar.xz |
completion: support completing non-ASCII pathnames
Unless the user has 'core.quotePath=false' somewhere in the
configuration, both 'git ls-files' and 'git diff-index' will by
default quote any pathnames that contain bytes with values higher than
0x80, and escape those bytes as '\nnn' octal values. This prevents
completing paths when the current path component to be completed
contains any non-ASCII, most notably UTF-8, characters, because none
of the listed quoted paths will match the current word on the command
line.
Set 'core.quotePath=false' for those 'git ls-files' and 'git
diff-index' invocations, so they won't consider bytes higher than 0x80
as "unusual", and won't quote pathnames containing such characters.
Note that pathnames containing backslash, double quote, or control
characters will still be quoted; a later patch in this series will
deal with those.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion')
-rw-r--r-- | contrib/completion/git-completion.bash | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 57fc7417f9..2a8fe2aa18 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -371,10 +371,12 @@ __gitcomp_file () __git_ls_files_helper () { if [ "$2" == "--committable" ]; then - __git -C "$1" diff-index --name-only --relative HEAD + __git -C "$1" -c core.quotePath=false diff-index \ + --name-only --relative HEAD else # NOTE: $2 is not quoted in order to support multiple options - __git -C "$1" ls-files --exclude-standard $2 + __git -C "$1" -c core.quotePath=false ls-files \ + --exclude-standard $2 fi } |