giti - Fix branch color and branch name
This commit is contained in:
parent
7adde4847b
commit
5f9af54423
13
giti
13
giti
@ -60,6 +60,12 @@ 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,13 +112,6 @@ 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_COMMIT
|
||||
echo $BRANCH_VAL
|
||||
BRANCH_VAL=$(echo $BRANCH_VAL | awk '{print $4}')
|
||||
echo $BRANCH_VAL
|
||||
BRANCH_VAL=${BRANCH_VAL::-1}
|
||||
echo $BRANCH_VAL
|
||||
else
|
||||
COLOR_BRANCH=$COLOR_BRANCH_BRANCH
|
||||
fi
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user