Skip to content

Commit a9eafbb

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents d52d548 + fc2953f commit a9eafbb

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

bash-git-prompt.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ def install
1818

1919
def caveats; <<-EOS.undent
2020
You should add the following to your .bashrc (or equivalent):
21-
if [ -f "$(brew --prefix bash-git-prompt)/share/gitprompt.sh" ]; then
21+
if [ -f #{HOMEBREW_PREFIX}/share/gitprompt.sh ]; then
2222
GIT_PROMPT_THEME=Default
23-
__GIT_PROMPT_DIR=$(brew --prefix)/opt/bash-git-prompt/share
24-
source "$(brew --prefix bash-git-prompt)/share/gitprompt.sh"
23+
. #{HOMEBREW_PREFIX}/share/gitprompt.sh
2524
fi
2625
EOS
2726
end

bash-git-prompt.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
%global END_TOKEN ### Generated by %{name} rpm package
33

44
Name: bash-git-prompt
5-
Version: 2.6.1
5+
Version: 2.6.2
66
Release: 1%{?dist}
77
Summary: Informative git prompt for bash and fish
88

gitprompt.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,12 @@ function updatePrompt() {
496496
unset GIT_REMOTE
497497
fi
498498

499-
local GIT_UPSTREAM="${git_status_fields[2]}"
500-
if [[ -z "${__GIT_PROMPT_SHOW_UPSTREAM}" || "^" == "$GIT_UPSTREAM" ]]; then
499+
local GIT_UPSTREAM_PRIVATE="${git_status_fields[2]}"
500+
if [[ -z "${__GIT_PROMPT_SHOW_UPSTREAM}" || "^" == "$GIT_UPSTREAM_PRIVATE" ]]; then
501501
unset GIT_UPSTREAM
502502
else
503-
GIT_UPSTREAM="${GIT_PROMPT_UPSTREAM//_UPSTREAM_/${GIT_UPSTREAM}}"
503+
export GIT_UPSTREAM=${GIT_UPSTREAM_PRIVATE}
504+
local GIT_FORMATTED_UPSTREAM="${GIT_PROMPT_UPSTREAM//_UPSTREAM_/\$GIT_UPSTREAM}"
504505
fi
505506

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

513514
local NEW_PROMPT="$EMPTY_PROMPT"
514515
if [[ -n "$git_status_fields" ]]; then
515-
local STATUS="${PROMPT_LEADING_SPACE}${GIT_PROMPT_PREFIX}${GIT_PROMPT_BRANCH}${GIT_BRANCH}${ResetColor}"
516+
local STATUS_PREFIX="${PROMPT_LEADING_SPACE}${GIT_PROMPT_PREFIX}${GIT_PROMPT_BRANCH}\${GIT_BRANCH}${ResetColor}${GIT_FORMATTED_UPSTREAM}"
517+
local STATUS=""
516518

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

545-
__add_status '$GIT_UPSTREAM'
546547
__chk_gitvar_status 'REMOTE' '-n'
547548
__add_status "$GIT_PROMPT_SEPARATOR"
548549
__chk_gitvar_status 'STAGED' '-ne 0'
@@ -553,7 +554,7 @@ function updatePrompt() {
553554
__chk_gitvar_status 'CLEAN' '-eq 1' -
554555
__add_status "$ResetColor$GIT_PROMPT_SUFFIX"
555556

556-
NEW_PROMPT="$(gp_add_virtualenv_to_prompt)$PROMPT_START$($prompt_callback)$STATUS$PROMPT_END"
557+
NEW_PROMPT="$(gp_add_virtualenv_to_prompt)$PROMPT_START$($prompt_callback)$STATUS_PREFIX$STATUS$PROMPT_END"
557558
else
558559
NEW_PROMPT="$EMPTY_PROMPT"
559560
fi

0 commit comments

Comments
 (0)