Skip to content

Commit 17ef3a6

Browse files
author
Rakotomandimby Mihamina
authored
Merge pull request #547 from bradmwilliams/last-prompt-indicator-fix
Resetting PROMPT_START/PROMPT_END on exit
2 parents 51080c2 + 8f10b91 commit 17ef3a6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

gitprompt.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ function we_are_on_repo() {
320320

321321
function update_old_git_prompt() {
322322
if [[ "${GIT_PROMPT_OLD_DIR_WAS_GIT:-0}" = 0 ]]; then
323+
OLD_PROMPT_START="${PROMPT_START}"
324+
OLD_PROMPT_END="${PROMPT_END}"
323325
OLD_GITPROMPT="${PS1}"
324326
fi
325327

@@ -332,6 +334,8 @@ function setGitPrompt() {
332334
local repo=$(git rev-parse --show-toplevel 2> /dev/null)
333335
if [[ ! -e "${repo}" ]] && [[ "${GIT_PROMPT_ONLY_IN_REPO-}" = 1 ]]; then
334336
# we do not permit bash-git-prompt outside git repos, so nothing to do
337+
PROMPT_START=${OLD_PROMPT_START}
338+
PROMPT_END=${OLD_PROMPT_END}
335339
PS1="${OLD_GITPROMPT}"
336340
return
337341
fi

0 commit comments

Comments
 (0)