Skip to content

Commit

Permalink
Add --branch to git flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Bradley Grzesiak committed Apr 13, 2012
1 parent 5fae317 commit 1cebf5c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .bash_login.prompt
Expand Up @@ -6,27 +6,27 @@ LIGHT_BLUE="\[\e[1;34m\]"
COLOR_NONE="\[\e[0m\]" COLOR_NONE="\[\e[0m\]"
LIGHT_GRAY="\[\e[0;37m\]" LIGHT_GRAY="\[\e[0;37m\]"


# $1 = git status --porcelain 2>&1 # $1 = git status --short --branch 2>&1
function parse_git_deleted { function parse_git_deleted {
[[ $(echo "$1" | grep "^.D") != "" ]] && echo "-" [[ $(echo "$1" | grep "^.D") != "" ]] && echo "-"
} }


# $1 = git status --porcelain 2>&1 # $1 = git status --short --branch 2>&1
function parse_git_added { function parse_git_added {
[[ $(echo "$1" | grep "^??") != "" ]] && echo '+' [[ $(echo "$1" | grep "^??") != "" ]] && echo '+'
} }


# $1 = git status --porcelain 2>&1 # $1 = git status --short --branch 2>&1
function parse_git_modified { function parse_git_modified {
[[ $(echo "$1" | grep "^.M") != "" ]] && echo "*" [[ $(echo "$1" | grep "^.M") != "" ]] && echo "*"
} }


# $1 = git status --porcelain 2>&1 # $1 = git status --short --branch 2>&1
function parse_git_staged { function parse_git_staged {
[[ $(echo "$1" | grep '^[MARCD]') != "" ]] && echo "~" [[ $(echo "$1" | grep '^[MARCD]') != "" ]] && echo "~"
} }


# $1 = git status --porcelain 2>&1 # $1 = git status --short --branch 2>&1
function parse_git_push_pull_status { function parse_git_push_pull_status {
if [[ $(echo "$1" | grep "^## .*\[ahead.*behind") != "" ]] if [[ $(echo "$1" | grep "^## .*\[ahead.*behind") != "" ]]
then then
Expand All @@ -40,12 +40,12 @@ function parse_git_push_pull_status {
fi fi
} }


# $1 = git status --porcelain 2>&1 # $1 = git status --short --branch 2>&1
function parse_git_dirty { function parse_git_dirty {
echo "$(parse_git_staged "$1")$(parse_git_added "$1")$(parse_git_modified "$1")$(parse_git_deleted "$1")$(parse_git_push_pull_status "$1")" echo "$(parse_git_staged "$1")$(parse_git_added "$1")$(parse_git_modified "$1")$(parse_git_deleted "$1")$(parse_git_push_pull_status "$1")"
} }


# $1 = git status --porcelain 2>&1 # $1 = git status --short --branch 2>&1
function parse_git_branch { function parse_git_branch {
branch=$(git br --no-color 2> /dev/null | sed -n '/^\*/p' | sed -e "s/^\* \(.*\)/\1/") branch=$(git br --no-color 2> /dev/null | sed -n '/^\*/p' | sed -e "s/^\* \(.*\)/\1/")
if [[ $branch != "" ]] if [[ $branch != "" ]]
Expand Down Expand Up @@ -75,7 +75,7 @@ function show_dirs_stack {


function prompt_func { function prompt_func {
previous_return_value=$? previous_return_value=$?
git_status=$(git status --porcelain 2>&1) git_status=$(git status --short --branch 2>&1)
prompt="${LIGHT_GRAY}$(show_dirs_stack)$(prompt_dir "$git_status")${YELLOW}$(parse_git_branch "$git_status")${COLOR_NONE} " prompt="${LIGHT_GRAY}$(show_dirs_stack)$(prompt_dir "$git_status")${YELLOW}$(parse_git_branch "$git_status")${COLOR_NONE} "
if test $previous_return_value -eq 0 if test $previous_return_value -eq 0
then then
Expand Down

0 comments on commit 1cebf5c

Please sign in to comment.