zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] _git: __git_files: do not pass $PREFIX to ls-files, breaks matcher-list
@ 2016-03-13 22:20 m0viefreak
  0 siblings, 0 replies; only message in thread
From: m0viefreak @ 2016-03-13 22:20 UTC (permalink / raw)
  To: zsh-workers; +Cc: m0viefreak

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-13 23:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-13 22:20 [PATCH] _git: __git_files: do not pass $PREFIX to ls-files, breaks matcher-list m0viefreak

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).