Skip to content

Commit

Permalink
bashrc: re-include $PS1 priority
Browse files Browse the repository at this point in the history
6e6310d (filesystem: New specific variable MSYS2_PS1., 2016-05-01)
introduced the MSYS2_PS1 prompt script proriority to allow multiple
device configurations.

Unfortunately it overwrote the $PS1, even when specifically set by the
users configuration, such as the Git-for-Windows SDK
see git-for-windows/git#794 (comment)
and the monkey patch fix
git-for-windows/build-extra#122.

Introduce a priority order so that the user's $PS1 (if set) has an
intermediate priority between the MSYS2_PS1 and the default PS1.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
  • Loading branch information
Philip Oakley committed Jul 5, 2016
1 parent b7496ff commit 031d975
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions filesystem/bash.bashrc
Expand Up @@ -39,11 +39,14 @@ unset _warning_prefix
unset _warning_file
unset _warning

# If MSYS2_PS1 is set, use that as default PS1, otherwise set a default prompt
# If MSYS2_PS1 is set, use that as default PS1;
# if a PS1 is already set, use that;
# otherwise set a default prompt
# of user@host, MSYSTEM variable, and current_directory
if test -n "${MSYS2_PS1}"
then PS1="${MSYS2_PS1}"
else PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[35m\]$MSYSTEM\[\e[0m\] \[\e[33m\]\w\[\e[0m\]\n\$ '
elif test -z "${PS1}"
then PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[35m\]$MSYSTEM\[\e[0m\] \[\e[33m\]\w\[\e[0m\]\n\$ '
fi

# Uncomment to use the terminal colours set in DIR_COLORS
Expand Down

0 comments on commit 031d975

Please sign in to comment.