mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
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
This commit is contained in:
parent
e181bc0653
commit
c8160f2954
2 changed files with 29 additions and 3 deletions
16
build
16
build
|
@ -12,11 +12,24 @@ fi
|
|||
export LC_ALL=C
|
||||
|
||||
if [ -z "${ZSH_VERSION-}" ] && command -v zsh >/dev/null 2>&1; then
|
||||
# Avoid bash 3.*.
|
||||
case "${BASH_VERSION-}" in
|
||||
[0-3].*) exec zsh "$0" "$@";;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Avoid ksh: https://github.com/romkatv/gitstatus/issues/282.
|
||||
if [ -n "${KSH_VERSION-}" ]; then
|
||||
if [ -z "${ZSH_VERSION-}" ] && command -v zsh >/dev/null 2>&1; then
|
||||
exec zsh "$0" "$@"
|
||||
elif [ -z "${BASH_VERSION-}" ] && command -v bash >/dev/null 2>&1 &&
|
||||
bash_version="$(bash --version 2>&1)"; then
|
||||
case "$bash_version" in
|
||||
*version\ [4-9]*|*version\ [1-9][0-9]*) exec bash "$0" "$@";;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
usage="$(command cat <<\END
|
||||
Usage: build [-m ARCH] [-c CPU] [-d CMD] [-i IMAGE] [-s] [-w]
|
||||
|
||||
|
@ -91,7 +104,7 @@ if [ -n "$gitstatus_install_tools" ]; then
|
|||
command pkg install -y cmake gmake binutils git perl5 wget
|
||||
;;
|
||||
openbsd)
|
||||
command pkg_add install cmake gmake gcc git wget
|
||||
command pkg_add cmake gmake gcc g++ git wget
|
||||
;;
|
||||
netbsd)
|
||||
command pkgin -y install cmake gmake binutils git
|
||||
|
@ -509,6 +522,7 @@ if [ -z "$gitstatus_cpu" ]; then
|
|||
arm64|aarch64) gitstatus_cpu=armv8-a;;
|
||||
ppc64le) gitstatus_cpu=powerpc64le;;
|
||||
riscv64) gitstatus_cpu=rv64imafdc;;
|
||||
loongarch64) gitstatus_cpu=loongarch64;;
|
||||
x86_64|amd64) gitstatus_cpu=x86-64;;
|
||||
x86) gitstatus_cpu=i586;;
|
||||
s390x) gitstatus_cpu=z900;;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue