about summary refs log tree commit diff
path: root/Functions/Chpwd
diff options
context:
space:
mode:
authorTorstein Hegge <hegge@resisty.net>2013-03-17 13:35:25 +0100
committerFrank Terbeck <ft@bewatermyfriend.org>2013-04-20 22:29:02 +0200
commitcc7437bf2fa92059564da2e2513980e9c5f687fa (patch)
tree661f097aab6b4099de6d0f8b5aab17b2b0957655 /Functions/Chpwd
parentfa7c51971d93d407f50757fbe2f81c91c227878d (diff)
downloadzsh-cc7437bf2fa92059564da2e2513980e9c5f687fa.tar.gz
zsh-cc7437bf2fa92059564da2e2513980e9c5f687fa.tar.xz
zsh-cc7437bf2fa92059564da2e2513980e9c5f687fa.zip
31159: git: Pass prefix filter to ls-files even if it matches no files
When a branch or tag name is completed with zsh in a large git repo, the
completion is slow if the given prefix doesn't match a file or directory in
the current working directory. Testing with linux.git, which contains release
tags like v3.9 and a directory virt/:

  git log v<tab>

takes about 0.5 seconds, while

  git log v3<tab>

takes about 25 seconds.

(Timed using zsh 4.3.17, on a fairly slow cpu. zsh from git appears to be
quite a bit faster, but the difference between completing v and v3 is still
large.)

The difference between the two is that v<tab> passes the result of v* to git
ls-files while v3<tab> determines that v3* matches no files, and passes an
empty prefix to git ls-files. So git ls-files lists all files in the repo
and passes that on to _multi_parts.

Making git do the expansion of the * after the prefix lets git ls-files v3*
return an empty list, making _multi_parts job easier.

This does not affect the behavior of git log <tab>, but improves the
performance of partial tag and branch tab-completion in the common case where
file names and tag/branch names don't overlap.
Diffstat (limited to 'Functions/Chpwd')
0 files changed, 0 insertions, 0 deletions