Skip to content

Commit 737ebec

Browse files
committed
Move the local variable to the else branch so that you don't do an unnecessary substitution
1 parent 47df726 commit 737ebec

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gitprompt.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,11 @@ function updatePrompt() {
497497
fi
498498

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

506507
local GIT_STAGED=${git_status_fields[3]}

0 commit comments

Comments
 (0)