Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=googlemail.com; s=20120113;
        h=from:to:cc:subject:date:message-id;
        bh=D/aa+s+Qtg9T3qxElFu7gPbnHzQ/KywF15lpQFvu96w=;
        b=GILtzJwGj0Y0w3yyPH8/hzuGIfmzGv58yDnYvebnk+iiOnrfB2fwvbSGxlIeG5l+N9
         QLudDUz+oaUEXyj+WHSEZEHq75PKjLXHb5aOpQxE6FoYuViL2ZXLYdd3lSRpc1dgsKLo
         XdiPPwmRucYWfJpD0dQ63fl8fG6wJJ2JsY+zdFm8YGeVmQ3+wU2a9rdgID174F937iob
         7dXhwUmGoNfjsdRoqeCu2DUAwzb0pYj8YlwtI55bFy5uU14R7TrinVBZj5pQRp9YRneD
         SwM8cOECfpxcln8x358XItKevO/QvJS5374453GhfRJWLcDSCJ29+aNKxNDvXxizUlpl
         tNyA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:to:cc:subject:date:message-id;
        bh=D/aa+s+Qtg9T3qxElFu7gPbnHzQ/KywF15lpQFvu96w=;
        b=A7qiU25jdJY+CFVTTzM5BJAWwabIIFpAD1AOMienvGrJJQAuib0V6h+O3CVe8x3pXp
         sb4+ZmpNnTkrWYKYX3qE3000AGC+weUzy98fiQwR0jlpFrrtW07i2ckSjw6UUMZC7gTE
         hCGMqEBpRoSOFAeQE7q53V5zLn7Vh0AZ4lOdC5GFf01ZOtTpTxGiIUcXBga1YLCz5BY4
         G/fCUajYgHJztTGk9lSwczBlqoq7JhrS5dU2fqfYwMYyJ21/2ERss371umPgS82E8N69
         KYMFtXOSaBbOV/M2zQ/hzkw8IAojWm5gSx6YcSgJjc6HPVNn959XqviujyVgjnVdKcps
         rT+Q==
X-Gm-Message-State: AD7BkJIxCEUYgOhdhxOlUNEiZVDuvrCJC4/WcNz/Xl4D91STGpWdrz2/YHz0WinrPkIF/Q==
X-Received: by 10.28.18.194 with SMTP id 185mr15090323wms.14.1457907648327;
        Sun, 13 Mar 2016 15:20:48 -0700 (PDT)
From: m0viefreak <m0viefreak.cm@googlemail.com>
To: zsh-workers@zsh.org
Cc: m0viefreak <m0viefreak.cm@googlemail.com>
Subject: [PATCH] _git: __git_files: do not pass $PREFIX to ls-files, breaks matcher-list
Date: Sun, 13 Mar 2016 23:20:42 +0100
Message-Id: <1457907642-4464-1-git-send-email-m0viefreak.cm@googlemail.com>
X-Mailer: git-send-email 2.5.0.234.gefc8a62
X-Seq: zsh-workers 38154

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

