Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _git: __git_files double-quotes ls-files pathspec
- X-seq: zsh-workers 55226
- From: Mike Smith <smithm0429@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: _git: __git_files double-quotes ls-files pathspec
- Date: Sun, 25 Oct 2026 16:14:53 -0400
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=to:subject:message-id:date:from:mime-version:dkim-signature; bh=UYVNXqd+yfZArOKxXg8jQwAtpScLVjpBMeRuY+tlfm8=; fh=SbTlPuNNxBzTkRlwWtqw/TXBY0HvGvtE97RpPp3sJPM=; b=MM60/q+Tq5vfyX0PL/lqHySiBGysjmKqatjrtU6Cf8ChK/LfTfO5hwXnlcvYFEFOz3 h194+2601qimlEXS6ziqHQ6uSW7kIvh0GAc2ppKWy0d30rJETcGJjF7S5RqIwBIYGQ+Q i25vcrSeZKRkK9WIYSxFzOBh4DGRCxkiCiwX5kQBTUuRssadj4HCgGsUKJx4baovMsb7 N3taES3YiKJ1EQjpXHdROuSKmbSm63I1pv8jLDWK1/vuEI5KnYLLJQiAW10u9xVtdPJy +sI5QemZ4nqqZl2YSsz3LHYF4MID+xqRhmEDG4Qpvn9BVRninUtHPaHiyA5pzrKNOfy/ u05g==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1792959306; cv=none; d=google.com; s=arc-20260327; b=jizxzasJOwE5vLr2GzOlom3iE7ah1prqnV6VrPniYduxTe4re2HwfkRtlInVNMtLQG ps5PWNjZvCpGNXEVMyU7jqbqgTmMxa/QM0S4IGgktCGleE2swOGUX7BpE1BqU458Rypz k8VxbzzdR4K84ytD6KU/eeyP18kxkgZThqG2lo6XI4iIe7EZNp4ZTX1bvI17K15IpX+Q fa7Lghp4MdnJiWaXDkC205iW8QHjB1a9D2fM9maqNnNT6HEdnxlULRSrBB4W77gFeWL4 BwlW8BY9sQh3t84ydp0dXbz7FxkannjyEFTViv3eEdWpssU1YC6NcWnx6dX0w1qJ5cEQ uaQg==
- Archived-at: <https://zsh.org/workers/55226>
- List-id: <zsh-workers.zsh.org>
Since 52904, __git_files quotes the ls-files pathspec twice: (qq) inside
(q), with a single eval in _call_program. git receives a literal
:(icase)'/repo/sub/../'* and matches nothing, so the CWD-only fallback
always runs. Visible when completing outside CWD.
Repro (zsh -f; autoload compinit; compinit):
git init r && cd r && touch a && mkdir sub && cd sub
git add ../<TAB> # nothing; expected ../a
Patch below uses _call_program -q (2026/msg00759) and quotes the
pattern so it isn't globbed. Tested with spaces, quotes and non-ASCII
in paths.
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 43d2e87..6f9eb35 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -7994,7 +7994,7 @@ __git_files () {
# First allow ls-files to pattern-match in case of remote repository. Use the
# icase pathspec magic word to ensure that we support case-insensitive path
# completion for users with the appropriate matcher configuration
- files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+:\(icase\)${(qq)pref}\*}:-.} 2>/dev/null)"})
+ files=(${(0)"$(_call_program -q files git ls-files -z --exclude-standard $opts -- "${${pref:+:(icase)$pref*}:-.}" 2>/dev/null)"})
__git_command_successful $pipestatus || return
# If ls-files succeeded but returned nothing, try again with no pattern. Note
Messages sorted by:
Reverse Date,
Date,
Thread,
Author