Make script more portable
This commit is contained in:
parent
e267362a9a
commit
38ed00375f
|
@ -8,6 +8,7 @@
|
||||||
function sanitize() {
|
function sanitize() {
|
||||||
unset GIT_CURRENT_BRANCH GIT_STATUS
|
unset GIT_CURRENT_BRANCH GIT_STATUS
|
||||||
unset GIT_STAGED GIT_MODIFIED GIT_UNTRACKED GIT_DELETED
|
unset GIT_STAGED GIT_MODIFIED GIT_UNTRACKED GIT_DELETED
|
||||||
|
unset GIT_COMMITS_BEHIND GIT_COMMITS_AHEAD GIT_COMMITS_STATUS
|
||||||
git rev-parse --git-dir &>/dev/null || return 1
|
git rev-parse --git-dir &>/dev/null || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,10 +55,10 @@ function parse_git_status() {
|
||||||
|
|
||||||
(( ${commits_behind} > 0 )) \
|
(( ${commits_behind} > 0 )) \
|
||||||
&& GIT_COMMITS_BEHIND="↓${commits_behind} " \
|
&& GIT_COMMITS_BEHIND="↓${commits_behind} " \
|
||||||
|| GIT_COMMITS_BEHIND=""
|
&& git_has_changes=1
|
||||||
(( ${commits_ahead} > 0 )) \
|
(( ${commits_ahead} > 0 )) \
|
||||||
&& GIT_COMMITS_AHEAD="↑${commits_ahead} " \
|
&& GIT_COMMITS_AHEAD="↑${commits_ahead} " \
|
||||||
|| GIT_COMMITS_AHEAD=""
|
&& git_has_changes=1
|
||||||
fi
|
fi
|
||||||
GIT_COMMITS_STATUS="${GIT_COMMITS_AHEAD}${GIT_COMMITS_BEHIND}"
|
GIT_COMMITS_STATUS="${GIT_COMMITS_AHEAD}${GIT_COMMITS_BEHIND}"
|
||||||
|
|
||||||
|
@ -70,12 +71,12 @@ function parse_git_status() {
|
||||||
&& GIT_DELETED="-${deleted_files} "
|
&& GIT_DELETED="-${deleted_files} "
|
||||||
(( ${untracked_files} > 0 )) \
|
(( ${untracked_files} > 0 )) \
|
||||||
&& GIT_UNTRACKED="?${untracked_files}"
|
&& GIT_UNTRACKED="?${untracked_files}"
|
||||||
FG_SPECIAL_COLOR="${FG_YELLOW}"
|
local fg_special='%F{yellow}'
|
||||||
else
|
else
|
||||||
FG_SPECIAL_COLOR="${FG_GREEN}"
|
local fg_special='%F{34}'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GIT_STATUS="${FG_SPECIAL_COLOR}"
|
GIT_STATUS="${fg_special}"
|
||||||
GIT_STATUS+=" ${GIT_CURRENT_BRANCH} "
|
GIT_STATUS+=" ${GIT_CURRENT_BRANCH} "
|
||||||
GIT_STATUS+="${GIT_COMMITS_STATUS}"
|
GIT_STATUS+="${GIT_COMMITS_STATUS}"
|
||||||
GIT_STATUS+="${GIT_MODIFIED}${GIT_STAGED}"
|
GIT_STATUS+="${GIT_MODIFIED}${GIT_STAGED}"
|
||||||
|
|
Loading…
Reference in New Issue