From 737ebec4c064ee6ce1624129d9548af3b55a5f4e Mon Sep 17 00:00:00 2001 From: oGre Date: Mon, 20 Mar 2017 20:11:44 +0100 Subject: [PATCH] Move the local variable to the else branch so that you don't do an unnecessary substitution --- gitprompt.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gitprompt.sh b/gitprompt.sh index 03c109a..4c7eea8 100755 --- a/gitprompt.sh +++ b/gitprompt.sh @@ -497,10 +497,11 @@ function updatePrompt() { fi export GIT_UPSTREAM="${git_status_fields[2]}" - local GIT_FORMATTED_UPSTREAM="${GIT_PROMPT_UPSTREAM//_UPSTREAM_/\$GIT_UPSTREAM}" if [[ -z "${__GIT_PROMPT_SHOW_UPSTREAM}" || "^" == "$GIT_UPSTREAM" ]]; then unset GIT_UPSTREAM unset GIT_FORMATTED_UPSTREAM + else + local GIT_FORMATTED_UPSTREAM="${GIT_PROMPT_UPSTREAM//_UPSTREAM_/\$GIT_UPSTREAM}" fi local GIT_STAGED=${git_status_fields[3]}