Commits

Andres Vargas committed 6dd62d2

fix bash

  • Participants
  • Parent commits 9bf4a0b

Comments (0)

Files changed (1)

 # the name of the git branch in the current directory
 set_git_branch() {
     unset GIT_BRANCH
-    local branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1 /'`;
-
-    if [ -n $branch ];
+    local branch=`git branch 2>/dev/null| grep -e '^*' | sed -E 's/^\* (.+)$/(\1) /'`;
+    if test $branch ;
         then
            GIT_BRANCH="${EMG}git:${NONE}$branch"
     fi
     set_svn_rev
     parse_svn_branch
     set_hg_branch
+    set_git_branch
     set_virtual_env_base
 
 
-    PS1="${K}[${B}\w${B}${K}]${NONE} ${GIT_BRANCH}${HG_BRANCH}${SVN_REV}${SVN_BRANCH}${VIRTUAL_ENV_BASE} \n$BLACK\u ${R} \$ ${NONE} "
+    PS1="\[\033[G\]${K}[${B}\w${B}${K}]${NONE} ${GIT_BRANCH}${HG_BRANCH}${SVN_REV}${SVN_BRANCH}${VIRTUAL_ENV_BASE} \n$BLACK\u ${R} \$ ${NONE} "
     #PS1="${EMB}[${NONE}${NEW_PWD}${EMB}] ${GIT_BRANCH}${HG_BRANCH}${SVN_REV}$(parse_svn_branch)${VIRTUAL_ENV_BASE}${B}\$ ${NONE}"
 }
 
 PROMPT_COMMAND=update_prompt
-$PS1="\[\033[G\]$PS1"