Skip to content

Commit

Permalink
Merge pull request #547 from bradmwilliams/last-prompt-indicator-fix
Browse files Browse the repository at this point in the history
Resetting PROMPT_START/PROMPT_END on exit
  • Loading branch information
Rakotomandimby Mihamina authored Jul 21, 2024
2 parents 51080c2 + 8f10b91 commit 17ef3a6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gitprompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ function we_are_on_repo() {

function update_old_git_prompt() {
if [[ "${GIT_PROMPT_OLD_DIR_WAS_GIT:-0}" = 0 ]]; then
OLD_PROMPT_START="${PROMPT_START}"
OLD_PROMPT_END="${PROMPT_END}"
OLD_GITPROMPT="${PS1}"
fi

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

0 comments on commit 17ef3a6

Please sign in to comment.