Skip to content

Commit

Permalink
48338: _git: Support case-insensitive path matching
Browse files Browse the repository at this point in the history
  • Loading branch information
okdana committed Apr 10, 2021
1 parent 283d2f3 commit 7269bc1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2021-04-10 dana <dana@dana.is>

* 48338: Completion/Unix/Command/_git: Support case-insensitive
path matching

2021-04-09 Peter Stephenson <p.w.stephenson@ntlworld.com>

* 48432 (plus test change): Src/Modules/zutil.c,
Expand Down
11 changes: 8 additions & 3 deletions Completion/Unix/Command/_git
Original file line number Diff line number Diff line change
Expand Up @@ -7155,11 +7155,16 @@ __git_files () {
local pref=${(Q)${~PREFIX}}
[[ $pref[1] == '/' ]] || pref=$gittoplevel$gitprefix$pref

# First allow ls-files to pattern-match in case of remote repository
files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\*}:-.} 2>/dev/null)"})
# 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\)$pref\*}:-.} 2>/dev/null)"})
__git_command_successful $pipestatus || return

# If ls-files succeeded but returned nothing, try again with no pattern
# If ls-files succeeded but returned nothing, try again with no pattern. Note
# that ls-files defaults to the CWD if not given a path, so if the file we
# were trying to add is in an *adjacent* directory, this won't return anything
# helpful either
if [[ -z "$files" && -n "$pref" ]]; then
files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- 2>/dev/null)"})
__git_command_successful $pipestatus || return
Expand Down

0 comments on commit 7269bc1

Please sign in to comment.