aboutsummaryrefslogtreecommitdiff
path: root/gitstatus/gitstatus.plugin.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-11-11 01:16:08 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-11-11 01:16:08 +0300
commit376c77712bf8eeadc2545b2eb9b584d615c7086e (patch)
tree2f3fd48f6011a2175a76d39cc6e277b2e9aac481 /gitstatus/gitstatus.plugin.zsh
parent37221b772089e5353ea2cf97bf254f7c113eb82a (diff)
pull upstream changes from gitstatus
Diffstat (limited to 'gitstatus/gitstatus.plugin.zsh')
-rw-r--r--gitstatus/gitstatus.plugin.zsh14
1 files changed, 10 insertions, 4 deletions
diff --git a/gitstatus/gitstatus.plugin.zsh b/gitstatus/gitstatus.plugin.zsh
index bdc8b7c3..6287798f 100644
--- a/gitstatus/gitstatus.plugin.zsh
+++ b/gitstatus/gitstatus.plugin.zsh
@@ -67,8 +67,8 @@ typeset -g _gitstatus_plugin_dir=${${(%):-%x}:A:h}
#
## Usage: gitstatus_query [OPTION]... NAME
#
-# -d STR Directory to query. Must be absolute. Defaults to $GIT_DIR or the current
-# directory if GIT_DIR is not set.
+# -d STR Directory to query. Defaults to the current directory. Has no effect if GIT_DIR
+# is set.
# -c STR Callback function to call once the results are available. Called only after
# gitstatus_query returns 0 with VCS_STATUS_RESULT=tout.
# -t FLOAT Timeout in seconds. Will block for at most this long. If no results are
@@ -135,7 +135,7 @@ function gitstatus_query() {
setopt err_return no_unset
local opt
- local dir=${GIT_DIR:-}
+ local dir
local callback
local -F timeout=-1
local no_diff=0
@@ -160,7 +160,13 @@ function gitstatus_query() {
local client_pid_var=_GITSTATUS_CLIENT_PID_${name}
[[ ${(P)client_pid_var} == $$ ]]
- [[ $dir == /* ]] || dir=${(%):-%/}/$dir
+ if [[ -z ${GIT_DIR:-} ]]; then
+ [[ $dir == /* ]] || dir=${(%):-%/}/$dir
+ elif [[ $GIT_DIR == /* ]]; then
+ dir=:$GIT_DIR
+ else
+ dir=:${(%):-%/}/$GIT_DIR
+ fi
local req_fd_var=_GITSTATUS_REQ_FD_${name}
local -i req_fd=${(P)req_fd_var}