Skip to content

completion: path completion improvements: speedup and quoted paths

SZEDER Gábor git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11t9902-completion: add tests demonstrating issues with quoted pathnamest/t9902-completion.sh+91 -015 replies
2/11completion: move __git_complete_index_file() next to its helperscontrib/completion/git-completion.bash+19 -200 replies
3/11completion: simplify prefix path component handling during path completioncontrib/completion/git-completion.bash+3 -40 replies
4/11completion: support completing non-ASCII pathnamescontrib/completion/git-completion.bash t/t9902-completion.sh+5 -30 replies
5/11completion: improve handling quoted paths on the command linecontrib/completion/git-completion.bash t/t9902-completion.sh+116 -60 replies
6/11completion: let 'ls-files' and 'diff-index' filter matching pathscontrib/completion/git-completion.bash t/t9902-completion.sh+7 -50 replies
7/11completion: use 'awk' to strip trailing path componentscontrib/completion/git-completion.bash+4 -70 replies
8/11t9902-completion: ignore COMPREPLY element order in some testst/t9902-completion.sh+4 -20 replies
9/11completion: remove repeated dirnames with 'awk' during path completioncontrib/completion/git-completion.bash+6 -20 replies
10/11completion: improve handling quoted paths in 'git ls-files's outputcontrib/completion/git-completion.bash t/t9902-completion.sh+79 -40 replies
11/11completion: fill COMPREPLY directly when completing pathscontrib/completion/git-completion.bash contrib/completion/git-completion.zsh+39 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/11] completion: path completion improvements: speedup and quoted paths

So, the highlights of this patch series are:

- At the top of the worktree in linux.git with over 62k files the time needed for 'git rm <TAB>' goes down from 2.15s to 0.052s.

- Same place, uniquely completing Makefile with 'git rm Mak<TAB>' goes

    down from 2.16s to 0.033s.

- Completing paths containing escaped or quoted characters (except newline) will work properly, and won't fall back to Bash's filename completion, e.g. git add File\\w<TAB>' will list 'File\with\backslashes.c', but not the corresponding ignored object file.

Well, at least it appears to be working for me, but dealing with quoting especially is nuts. If someone knows simpler ways to remove escaping and quoting than in the functions added in patches 5 and 10, then please, I would really love to learn something :)

Someone using ZSH regularly should have a look and test it.

SZEDER Gábor (11):
t9902-completion: add tests demonstrating issues with quoted pathnames
completion: move __git_complete_index_file() next to its helpers
completion: simplify prefix path component handling during path
completion
completion: support completing non-ASCII pathnames
completion: improve handling quoted paths on the command line
completion: let 'ls-files' and 'diff-index' filter matching paths
completion: use 'awk' to strip trailing path components
t9902-completion: ignore COMPREPLY element order in some tests
completion: remove repeated dirnames with 'awk' during path completion
completion: improve handling quoted paths in 'git ls-files's output
completion: fill COMPREPLY directly when completing paths

 contrib/completion/git-completion.bash | 218 +++++++++++++++++++++----
 contrib/completion/git-completion.zsh  |   9 +
 t/t9902-completion.sh                  | 153 ++++++++++++++++-
 3 files changed, 348 insertions(+), 32 deletions(-)
Signature · 1 line
2.17.0.366.gbe216a3084