summaryrefslogtreecommitdiff
path: root/01_Functions.zsh
diff options
context:
space:
mode:
Diffstat (limited to '01_Functions.zsh')
-rw-r--r--01_Functions.zsh29
1 files changed, 29 insertions, 0 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh
index 2d2407a..810a04e 100644
--- a/01_Functions.zsh
+++ b/01_Functions.zsh
@@ -14,6 +14,35 @@ cmd_exists ()
which $1 2>/dev/null >&2
}
+get_git_branch ()
+{
+ echo $(git branch 2>&- | grep -E '^\* ' | cut -c3-)
+}
+
+get_git_status ()
+{
+ ## GIT TRACKING ##
+ if [ "$GITCHECK" != "" ]
+ then
+ GITBRANCH=$(get_git_branch);
+ if [ "$GITBRANCH" != "" ]
+ then
+ preprint "Checking git status..."
+ _git_status=$(git-runstatus 2>&- | grep -E '^# ([[:alpha:]]+ )+(but not|to be)( [[:alpha:]]+)+:$')
+ if [ "$(grep "but not" <<< $_git_status)" != "" ] ; then
+ COLOR_GIT=$COLOR_NOT_UP_TODATE
+ elif [ "$(grep "to be committed" <<< $_git_status)" != "" ] ; then
+ COLOR_GIT=$COLOR_TOBE_COMMITED
+ else
+ COLOR_GIT=$COLOR_BRANCH_OR_REV
+ fi
+
+ fi
+ fi
+ GitBranch=${GITBRANCH:+:$GITBRANCH}
+ GITBRANCH=${GITBRANCH:+$C_$COLOR_DOUBLEDOT$_C:$C_$COLOR_GIT$_C$GITBRANCH}
+}
+
normal_user ()
{
if [ -e /etc/login.defs ]