summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorDaniel Shahaf <danielsh@apache.org>2020-03-07 21:50:46 +0000
committerDaniel Shahaf <danielsh@apache.org>2020-03-07 21:50:46 +0000
commitb5f05b29ba3d8884cdcb344fd6e5f62aeaa9a3fc (patch)
tree7142dec586d8f1fb3b9333ff50d6e1083a7b7460 /Completion/Unix/Command
parentdd50f125b5eb65896642d2ff664adefd33f1004c (diff)
parent4ce0cff5e91608598adf4a72318fc868681e398d (diff)
downloadzsh-b5f05b29ba3d8884cdcb344fd6e5f62aeaa9a3fc.tar.gz
zsh-b5f05b29ba3d8884cdcb344fd6e5f62aeaa9a3fc.zip
Merge remote-tracking branch 'origin/5.9'
* origin/5.9: unposted: Move a new incompatibility notice. unposted: Fix trailing whitespace in test expectations. 45342: Add tests for interaction between autoloadable parameters and module loading. 45313: _git: Support completion from outside of a worktree when --git-dir/--work-tree are specified on the command line 45304: Do execute the always block even when the try/always block itself is the last command. 45292: D02glob: Add regression test for macOS stat(2) misbehaviour 45291: A glob with a trailing slash will now match unreadable/unexecutable directories. 45288: _git: Complete bisect/new as well as bisect/bad. 45246: Make --disable-multibyte warn, since the test suite fails in that configuration. 45213: Make --enable-gdbm default to false, rather than default to true with an unavoidable warning. unposted (follow-up to 45131): Extra testing by Mikael 45137: zformat: Allow the specifying minimum width and a dot with an empty maximum width. 45138: Add zformat unit tests. 45131: Make a function that redefines itself preserve its tracedness.
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_git15
1 files changed, 8 insertions, 7 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 97ab26512..8487ebc1a 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -6716,14 +6716,12 @@ __git_heads_local () {
local f gitdir
declare -a heads
- heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads 2>/dev/null)"})
+ heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads refs/bisect refs/stash 2>/dev/null)"})
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
if __git_command_successful $pipestatus; then
for f in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
[[ -f $gitdir/$f ]] && heads+=$f
done
- [[ -f $gitdir/refs/stash ]] && heads+=stash
- [[ -f $gitdir/refs/bisect/bad ]] && heads+=bisect/bad
fi
__git_describe_commit heads heads-local "local head" "$@"
@@ -7084,21 +7082,23 @@ __git_files_relative () {
(( $+functions[__git_files] )) ||
__git_files () {
- local compadd_opts opts tag description gitcdup gitprefix files expl
+ local compadd_opts opts tag description gittoplevel gitprefix files expl
zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F:
zparseopts -D -E -a opts -- -cached -deleted -modified -others -ignored -unmerged -killed x+: --exclude+:
tag=$1 description=$2; shift 2
- gitcdup=$(_call_program gitcdup git rev-parse --show-cdup 2>/dev/null)
+ gittoplevel=$(_call_program toplevel git rev-parse --show-toplevel 2>/dev/null)
__git_command_successful $pipestatus || return 1
+ [[ -n $gittoplevel ]] && gittoplevel+="/"
gitprefix=$(_call_program gitprefix git rev-parse --show-prefix 2>/dev/null)
__git_command_successful $pipestatus || return 1
# TODO: --directory should probably be added to $opts when --others is given.
- local pref=$gitcdup$gitprefix$PREFIX
+ 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)"})
@@ -8140,7 +8140,8 @@ _git() {
;;
(option-or-argument)
curcontext=${curcontext%:*:*}:git-$words[1]:
- (( $+opt_args[--git-dir] )) && local -x GIT_DIR=$opt_args[--git-dir]
+ (( $+opt_args[--git-dir] )) && local -x GIT_DIR=${(Q)${~opt_args[--git-dir]}}
+ (( $+opt_args[--work-tree] )) && local -x GIT_WORK_TREE=${(Q)${~opt_args[--work-tree]}}
if ! _call_function ret _git-$words[1]; then
if [[ $words[1] = \!* ]]; then
words[1]=${words[1]##\!}