Skip to content

Commit b3f4d82

Browse files
committed
Export GIT_BRANCH as environment variable for 3rd party usage, fixes #244
1 parent ac77174 commit b3f4d82

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
@@ -284,6 +284,7 @@ function git_prompt_config() {
284284
fi
285285
# __GIT_STATUS_CMD defined
286286
fi
287+
unset GIT_BRANCH
287288
}
288289

289290
function setLastCommandState() {
@@ -449,7 +450,7 @@ function updatePrompt() {
449450
local -a git_status_fields
450451
git_status_fields=($("$__GIT_STATUS_CMD" 2>/dev/null))
451452

452-
local GIT_BRANCH=$(replaceSymbols ${git_status_fields[0]})
453+
export GIT_BRANCH=$(replaceSymbols ${git_status_fields[0]})
453454
local GIT_REMOTE="$(replaceSymbols ${git_status_fields[1]})"
454455
if [[ "." == "$GIT_REMOTE" ]]; then
455456
unset GIT_REMOTE

0 commit comments

Comments
 (0)