Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resetting PROMPT_START/PROMPT_END on exit #547

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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