mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 07:24:39 +01:00
git_prompt_status now compatible with zsh
This commit is contained in:
parent
a29f48070a
commit
e1adf97cfe
4 changed files with 17 additions and 11 deletions
17
zsh/prompt
17
zsh/prompt
|
|
@ -127,16 +127,15 @@ prompt_dir() {
|
|||
}
|
||||
|
||||
prompt_git() {
|
||||
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
||||
if [[ -n $GIT_PS1_STATUS ]]; then
|
||||
PROMPT_VCS_TYPE='git'
|
||||
PROMPT_VCS_REF=$(git symbolic-ref HEAD 2> /dev/null)
|
||||
PROMPT_VCS_REF="${PROMPT_VCS_REF/refs\/heads\//}"
|
||||
PROMPT_VCS_WPATH=$(cd $(dirname $(git rev-parse --git-dir)) && pwd)
|
||||
PROMPT_VCS_WNAME=$(basename $PROMPT_VCS_WPATH)
|
||||
PROMPT_VCS_WPWD="${PWD#$PROMPT_VCS_WPATH}"
|
||||
PROMPT_VCS_WPWD="${PROMPT_VCS_WPWD#/}"
|
||||
git diff --ignore-submodules --quiet
|
||||
PROMPT_VCS_DIRTY=$?
|
||||
PROMPT_VCS_REF="$GIT_PS1_BRANCH"
|
||||
PROMPT_VCS_WPATH="$GIT_PS1_TOPLEVEL"
|
||||
PROMPT_VCS_WNAME="$GIT_PS1_NAME"
|
||||
PROMPT_VCS_WPWD="$GIT_PS1_PREFIX"
|
||||
[[ "$GIT_PS1_STATUS" == *t* ]] && PROMPT_VCS_DIRTY=1
|
||||
[[ "$GIT_PS1_STATUS" == *u* ]] && PROMPT_VCS_DIRTY=1
|
||||
[[ "$GIT_PS1_STATUS" == *s* ]] && PROMPT_VCS_DIRTY=1
|
||||
return 0
|
||||
else
|
||||
unset PROMPT_VCS_TYPE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue