From c8160f29543a2f57ae7149103deefa029fd4e861 Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Tue, 4 Jan 2022 12:14:19 +0100 Subject: 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 --- gitstatus.plugin.zsh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'gitstatus.plugin.zsh') 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 -- cgit v1.2.3