File tree Expand file tree Collapse file tree 4 files changed +5
-52
lines changed Expand file tree Collapse file tree 4 files changed +5
-52
lines changed Original file line number Diff line number Diff line change @@ -56,16 +56,16 @@ _ret_prompt() {
56
56
}
57
57
58
58
_ret_same () { return $? ; }
59
- . /etc/bashrc_repo & > /dev/null || alias _repo_status =' _ret_same' # Fallback
59
+ . /etc/bashrc_repo & > /dev/null || alias _git_branch =' _ret_same' # Fallback
60
60
# To be shipped together. See comments in bashrc_repo on _ret and _ret_status().
61
61
62
62
# Use "\w" if you want the script to display full path
63
63
# How about using cut to "\w($PWD)" to give path of a certain depth?
64
64
# Well, forget it.
65
65
if [[ $EUID == 0 ]] ; then
66
- PS1=" $RED \u $NORMAL [ \W\$ (_repo_status ) ]$RED \$ (_ret_prompt) $NORMAL "
66
+ PS1=" $RED \u $NORMAL [ \W\$ (_git_branch ) ]$RED \$ (_ret_prompt) $NORMAL "
67
67
else
68
- PS1=" $GREEN \u $NORMAL [ \W\$ (_repo_status ) ]$GREEN \$ (_ret_prompt) $NORMAL "
68
+ PS1=" $GREEN \u $NORMAL [ \W\$ (_git_branch ) ]$GREEN \$ (_ret_prompt) $NORMAL "
69
69
fi
70
70
71
71
# Extra Aliases for those lazy ones :)
Original file line number Diff line number Diff line change @@ -34,15 +34,16 @@ alias __git_branch="git branch 2>/dev/null | grep '*' | sed 's/*\ //g'"
34
34
# From http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt
35
35
# Modified.
36
36
_git_branch() {
37
+ _ret=$?
37
38
if (git branch &>/dev/null)
38
39
then if (LANG=C git status | grep "nothing to commit" &>/dev/null)
39
40
then printf "\e[1m@\e[0;32m$(__git_branch)\e[0m"
40
41
elif (LANG=C git status | grep "nothing added to commit" &>/dev/null) # Untracked
41
42
then printf "\e[1m@\e[0;35m$(__git_branch)\e[0m"
42
43
else printf "\e[1m@$IRED$(__git_branch)\e[0m" # Change not added/not merged yet
43
44
fi
44
- else false # Necessary, read bashrc_repo.
45
45
fi
46
+ return $_ret
46
47
}
47
48
48
49
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments