Subject: [PATCH] _git: __git_files: do not pass $PREFIX to ls-files, breaks matcher-list
From: m0viefreak <[email-masked]>
To: [email-masked]
Cc: m0viefreak <[email-masked]>
Date: Sun, 13 Mar 2016 23:20:42 +0100
List-Id: Zsh Workers List <zsh-workers.zsh.org>

When getting file lists from git-ls-files, do not pass the
typed $PREFIX, because this breaks the matcher-list zstyle.

There is no need to pre-filter the results that strictly when
calling ls-files, beause the results are passed to _multi_parts
which deals with that anyways.

Example:

- Modifications to files dir/FIRST.txt and dir/SECOND.txt in a git repo
- matcher-list zstyle set to ignore case: m:{a-z}={A-Z}
- Attempt to complete: git checkout -- dir/f<tab>
- Before this fix: git-ls-files is called
    git ls-files -z --exclude-standard --modified -- 'dir/f*'
  and returns nothing, because it does not know of zsh's matcher-list.
  No completions are offered, even though matching should work
  case-insensitively.
- After this fix: git-ls-files is called
    git ls-files -z --exclude-standard --modified -- 'dir/*'
  which returns (dir/FIRST.txt dir/SECOND.txt).
  All results are then passed to _multi_parts which deals with the
  actual completion, taking into account the matcher spec,
  and correctly offers the matching result
    FIRST.txt
---
 Completion/Unix/Command/_git | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index c989a2c..858331d 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -6034,7 +6034,7 @@ __git_files () {
 
   # TODO: --directory should probably be added to $opts when --others is given.
 
-  local pref=$gitcdup$gitprefix$PREFIX
+  local pref=$gitcdup$gitprefix
 
   # First allow ls-files to pattern-match in case of remote repository
   files=(${(0)"$(_call_program files git ls-files -z --exclude-standard $opts -- ${pref:+$pref\\\*} 2>/dev/null)"})
-- 
2.5.0.234.gefc8a62