From a2098b0b26b47917cc725b387c63d75dfe0098f2 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Mon, 27 Jan 2014 21:54:13 -0800 Subject: users/18368: compromise to restore partial path completion inadvertently removed by 31159 --- Completion/Unix/Command/_git | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 43a01d9ff..c09f2555a 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5683,9 +5683,17 @@ __git_files () { # TODO: --directory should probably be added to $opts when --others is given. local pref=$gitcdup$gitprefix$PREFIX + + # 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)"}) __git_command_successful $pipestatus || return + # If ls-files succeeded but returned nothing, try again with no pattern + if [[ -z "$files" && -n "$pref" ]]; then + files=(${(0)"$(_call_program files git ls-files -z --exclude-standard $opts -- 2>/dev/null)"}) + __git_command_successful $pipestatus || return + fi + # _wanted $tag expl $description _files -g '{'${(j:,:)files}'}' $compadd_opts - _wanted $tag expl $description _multi_parts -f $compadd_opts - / files } -- cgit 1.4.1