github #156: _git: fix --git-dir and --work-tree options when used with parameters

This commit is contained in:
Bao Trinh
2026-02-18 06:51:14 -06:00
committed by dana
parent 2f338edfd9
commit e2aa560919
2 changed files with 5 additions and 2 deletions

View File

@@ -1,5 +1,8 @@
2026-04-05 dana <dana@dana.is>
* Bao Trinh: github #156: Completion/Unix/Command/_git: fix
--git-dir and --work-tree options when used with parameters
* Christopher Bock: github #153: Completion/Unix/Command/_zfs:
_zfs update zpool-prop's

View File

@@ -8964,8 +8964,8 @@ _git() {
;;
(option-or-argument)
curcontext=${curcontext%:*:*}:git-$words[1]:
(( $+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]}}
(( $+opt_args[--git-dir] )) && local -x GIT_DIR=${(eQ)${~opt_args[--git-dir]}}
(( $+opt_args[--work-tree] )) && local -x GIT_WORK_TREE=${(eQ)${~opt_args[--work-tree]}}
if ! _call_function ret _git-$words[1]; then
if [[ $words[1] = \!* ]]; then
words[1]=${words[1]##\!}