giti - branch color fix
This commit is contained in:
parent
5f9af54423
commit
8e3ee44ea4
22
giti
22
giti
@ -60,12 +60,6 @@ GIT_URL="$(LANGUAGE='en_US.UTF-8 git' git config --get remote.origin.url 2> /dev
|
||||
GIT_STATUS="$(LANGUAGE='en_US.UTF-8 git' git status -sb 2> /dev/null)"
|
||||
GIT_FILES="$(LANGUAGE='en_US.UTF-8 git' git status -s 2> /dev/null)"
|
||||
BRANCH_VAL="$(LANGUAGE='en_US.UTF-8 git' git branch 2> /dev/null | sed --quiet 's/* \(.*\)/\1/p')"
|
||||
if [[ $BRANCH_VAL == *"HEAD detached at"* ]]; then
|
||||
COLOR_BRANCH=$COLOR_BRANCH_COMMIT
|
||||
BRANCH_VAL=$(echo $BRANCH_VAL | awk '{print $4}')
|
||||
BRANCH_VAL=${BRANCH_VAL::-1}
|
||||
COLOR_BRANCH_BRANCH=$COLOR_BRANCH_COMMIT
|
||||
fi
|
||||
STASH_VAL=$(LANGUAGE='en_US.UTF-8 git' git stash list 2> /dev/null | wc -l)
|
||||
|
||||
# decision for git output (path is repository)
|
||||
@ -106,16 +100,20 @@ if [[ ! -z "$GIT_FILES" ]]; then
|
||||
fi
|
||||
|
||||
# GIT STATUS COLOR ################################################################################
|
||||
if [[ $BRANCH_VAL == "master" || $BRANCH_VAL == "main" ]]; then
|
||||
COLOR_BRANCH=$COLOR_BRANCH_CLEAN
|
||||
elif [[ $BRANCH_VAL == *"HEAD detached at"* ]]; then
|
||||
COLOR_BRANCH=$COLOR_BRANCH_COMMIT
|
||||
BRANCH_VAL=$(echo $BRANCH_VAL | awk '{print $4}')
|
||||
BRANCH_VAL=${BRANCH_VAL::-1}
|
||||
else
|
||||
COLOR_BRANCH=$COLOR_BRANCH_BRANCH
|
||||
fi
|
||||
|
||||
if [[ $COMMITED_VAL > 0 || $CHANGED_VAL > 0 ]]; then
|
||||
COLOR_BRANCH="$COLOR_BRANCH_CHANGED"
|
||||
elif [[ $BEHIND_VAL > 0 || $AHEAD_VAL > 0 || $NEW_VAL > 0 ]]; then
|
||||
COLOR_BRANCH="$COLOR_BRANCH_OUTDATED"
|
||||
elif [[ $BRANCH_VAL != "master" && $BRANCH_VAL != "main" ]]; then
|
||||
if [[ $BRANCH_VAL == *"HEAD detached at"* ]]; then
|
||||
COLOR_BRANCH=$COLOR_BRANCH_BRANCH
|
||||
fi
|
||||
else
|
||||
COLOR_BRANCH=$COLOR_BRANCH_CLEAN
|
||||
fi
|
||||
|
||||
# GIT GATHERING ###################################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user