diff options
author | Oliver Kiddle <opk@zsh.org> | 2021-09-04 13:11:07 +0200 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2021-09-04 13:11:07 +0200 |
commit | b60bab1cc1e7ba94913a0be29ce270798aa55bf7 (patch) | |
tree | 69e6cc0255fb3e9720c59c75c2c74b69af6a8e5d /Completion/Unix/Command | |
parent | 64befeb4ca5bd9ddb7162584585cd9041711ff8c (diff) | |
download | zsh-b60bab1cc1e7ba94913a0be29ce270798aa55bf7.tar.gz zsh-b60bab1cc1e7ba94913a0be29ce270798aa55bf7.tar.xz zsh-b60bab1cc1e7ba94913a0be29ce270798aa55bf7.zip |
49345: fix git file completion for paths starting with ../
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r-- | Completion/Unix/Command/_git | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index a82b70e83..7c7fb22bc 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -7370,7 +7370,6 @@ __git_changed_files () { # which case it is relative to the repository root. (( $+functions[__git_tree_files] )) || __git_tree_files () { - local multi_parts_opts local tree Path integer at_least_one_tree_added local -a tree_files compadd_opts @@ -7383,11 +7382,12 @@ __git_tree_files () { zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F: - [[ "$1" == */ ]] && Path="$1" || Path="${1:h}/" + Path=${(M)1##(../)#} + [[ ${1##(../)#} = */* ]] && extra_args+=( -r ) shift (( at_least_one_tree_added = 0 )) - for tree in $*; do - tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree -r ${(q)extra_args} --name-only -z ${(q)tree} 2>/dev/null)"}) + for tree; do + tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree $extra_args --name-only -z ${(q)tree} $Path 2>/dev/null)"}) __git_command_successful $pipestatus && (( at_least_one_tree_added = 1 )) done |