Skip to content

Commit

Permalink
Merge branch 'ogr3-pwned-with-upstream'
Browse files Browse the repository at this point in the history
Fixes #310
  • Loading branch information
magicmonty committed Mar 26, 2017
2 parents beedf2e + 46aaea2 commit c4a0a2d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions gitprompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,12 @@ function updatePrompt() {
unset GIT_REMOTE
fi

local GIT_UPSTREAM="${git_status_fields[2]}"
if [[ -z "${__GIT_PROMPT_SHOW_UPSTREAM}" || "^" == "$GIT_UPSTREAM" ]]; then
local GIT_UPSTREAM_PRIVATE="${git_status_fields[2]}"
if [[ -z "${__GIT_PROMPT_SHOW_UPSTREAM}" || "^" == "$GIT_UPSTREAM_PRIVATE" ]]; then
unset GIT_UPSTREAM
else
GIT_UPSTREAM="${GIT_PROMPT_UPSTREAM//_UPSTREAM_/${GIT_UPSTREAM}}"
export GIT_UPSTREAM=${GIT_UPSTREAM_PRIVATE}
local GIT_FORMATTED_UPSTREAM="${GIT_PROMPT_UPSTREAM//_UPSTREAM_/\$GIT_UPSTREAM}"
fi

local GIT_STAGED=${git_status_fields[3]}
Expand All @@ -512,7 +513,8 @@ function updatePrompt() {

local NEW_PROMPT="$EMPTY_PROMPT"
if [[ -n "$git_status_fields" ]]; then
local STATUS="${PROMPT_LEADING_SPACE}${GIT_PROMPT_PREFIX}${GIT_PROMPT_BRANCH}${GIT_BRANCH}${ResetColor}"
local STATUS_PREFIX="${PROMPT_LEADING_SPACE}${GIT_PROMPT_PREFIX}${GIT_PROMPT_BRANCH}\${GIT_BRANCH}${ResetColor}${GIT_FORMATTED_UPSTREAM}"
local STATUS=""

# __add_status KIND VALEXPR INSERT
# eg: __add_status 'STAGED' '-ne 0'
Expand Down Expand Up @@ -542,7 +544,6 @@ function updatePrompt() {
eval "STATUS=\"$STATUS$1\""
}

__add_status '$GIT_UPSTREAM'
__chk_gitvar_status 'REMOTE' '-n'
__add_status "$GIT_PROMPT_SEPARATOR"
__chk_gitvar_status 'STAGED' '-ne 0'
Expand All @@ -553,7 +554,7 @@ function updatePrompt() {
__chk_gitvar_status 'CLEAN' '-eq 1' -
__add_status "$ResetColor$GIT_PROMPT_SUFFIX"

NEW_PROMPT="$(gp_add_virtualenv_to_prompt)$PROMPT_START$($prompt_callback)$STATUS$PROMPT_END"
NEW_PROMPT="$(gp_add_virtualenv_to_prompt)$PROMPT_START$($prompt_callback)$STATUS_PREFIX$STATUS$PROMPT_END"
else
NEW_PROMPT="$EMPTY_PROMPT"
fi
Expand Down

0 comments on commit c4a0a2d

Please sign in to comment.