diff options
author | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2022-01-04 14:14:19 +0300 |
---|---|---|
committer | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2022-01-04 14:14:19 +0300 |
commit | c8160f29543a2f57ae7149103deefa029fd4e861 (patch) | |
tree | 11ce97356fbdd9baed6e826b18aeac9b26a6cdb8 /gitstatus.plugin.zsh | |
parent | e181bc0653ae15ba5730a65b253d499bf22a31bf (diff) |
Squashed 'gitstatus/' changes from f1cf61b24..e02d9eedd
e02d9eedd fix cwd detection when it has weird characters
78c171590 Loongarch support (#290)
be6396b1a fix pkg_add command on openbsd (#282)
f1c89585a avoid ksh if possible (it's broken; see #282)
22407d6fd bug fix: correctly resolve pwd when it contains control chars
git-subtree-dir: gitstatus
git-subtree-split: e02d9eedd9d8f3689e6a6cdccec70b55cf87dca6
Diffstat (limited to 'gitstatus.plugin.zsh')
-rw-r--r-- | gitstatus.plugin.zsh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gitstatus.plugin.zsh b/gitstatus.plugin.zsh index cef78974..181e756a 100644 --- a/gitstatus.plugin.zsh +++ b/gitstatus.plugin.zsh @@ -185,9 +185,21 @@ function gitstatus_query"${1:-}"() { (( _GITSTATUS_STATE_$name == 2 )) || return if [[ -z $GIT_DIR ]]; then - [[ $dir == /* ]] || dir=${(%):-%/}/$dir + if [[ $dir != /* ]]; then + if [[ $PWD == /* && $PWD -ef . ]]; then + dir=$PWD/$dir + else + dir=${dir:a} + fi + fi else - [[ $GIT_DIR == /* ]] && dir=:$GIT_DIR || dir=:${(%):-%/}/$GIT_DIR + if [[ $GIT_DIR == /* ]]; then + dir=:$GIT_DIR + elif [[ $PWD == /* && $PWD -ef . ]]; then + dir=:$PWD/$GIT_DIR + else + dir=:${GIT_DIR:a} + fi fi if [[ $dir != (|:)/* ]]; then |