1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-23 22:30:07 +00:00

Make the agnoster git branch status added in #7209 optional

This commit is contained in:
Stephen Gelman 2024-06-13 19:44:57 -05:00
parent 51d999651d
commit fbccfe80fd

View file

@ -80,6 +80,8 @@ esac
: ${AGNOSTER_STATUS_RETVAL_NUMERIC:=false} : ${AGNOSTER_STATUS_RETVAL_NUMERIC:=false}
# Show git working dir in the style "/git/root   master  relative/dir" instead of "/git/root/relative/dir   master" # Show git working dir in the style "/git/root   master  relative/dir" instead of "/git/root/relative/dir   master"
: ${AGNOSTER_GIT_INLINE:=false} : ${AGNOSTER_GIT_INLINE:=false}
# Show the git branch status in the prompt rather than the generic branch symbol
: ${AGNOSTER_GIT_BRANCH_STATUS:=true}
# Special Powerline characters # Special Powerline characters
@ -181,6 +183,7 @@ prompt_git() {
prompt_segment "$AGNOSTER_GIT_CLEAN_BG" "$AGNOSTER_GIT_CLEAN_FG" prompt_segment "$AGNOSTER_GIT_CLEAN_BG" "$AGNOSTER_GIT_CLEAN_FG"
fi fi
if [[ $AGNOSTER_GIT_BRANCH_STATUS == 'true' ]]; then
local ahead behind local ahead behind
ahead=$(command git log --oneline @{upstream}.. 2>/dev/null) ahead=$(command git log --oneline @{upstream}.. 2>/dev/null)
behind=$(command git log --oneline ..@{upstream} 2>/dev/null) behind=$(command git log --oneline ..@{upstream} 2>/dev/null)
@ -191,6 +194,7 @@ prompt_git() {
elif [[ -n "$behind" ]]; then elif [[ -n "$behind" ]]; then
PL_BRANCH_CHAR=$'\u21b0' PL_BRANCH_CHAR=$'\u21b0'
fi fi
fi
if [[ -e "${repo_path}/BISECT_LOG" ]]; then if [[ -e "${repo_path}/BISECT_LOG" ]]; then
mode=" <B>" mode=" <B>"