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 priority to allow multiple
device configurations.

Unfortunately, if MSYS2_PS1 was not set it overwrote the $PS1, even
when specifically set by the users configuration, such as provided in 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 6, 2016
1 parent b7496ff commit 17a6004
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions filesystem/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

pkgname=filesystem
pkgver=2016.06
pkgrel=1
pkgrel=2
pkgdesc='Base filesystem'
arch=('i686' 'x86_64')
license=('BSD')
Expand Down Expand Up @@ -49,7 +49,7 @@ source=('bash.bash_logout'
'mingw32-config.site'
'redirect-config.site')
sha256sums=('6d651f6b0b2d173961a3fa21acd9d44c783ed9cd73a031687698c8b9ed1f6dee'
'b985a05176a940bfd46c33ac1a1f78b3b09508d8b7c28f8e23e542975e09e0e2'
'82fb61ad0e5625fe29d4fd2ef4d191cb76b24be17967076a45ba9941f855eb48'
'99eae6e37081edd73b399009c85f4a67a0c14481241ee4937ab45c4178b540fb'
'ed08a8bd0919ba29ec5dd2d0c74ba74324ca2bcbf7852354b0b6c523809029a0'
'4330edf340394d0dae50afb04ac2a621f106fe67fb634ec81c4bfb98be2a1eb5'
Expand Down
7 changes: 5 additions & 2 deletions filesystem/bash.bashrc
Original file line number Diff line number Diff line change
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

4 comments on commit 17a6004

@toby-allsopp
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I don't set PS1, it defaults to \s-\v\$, which, after this change, prevents the default from being set.

This code runs before ~/,bashrc anyway, so where would I set PS1 such that the old code would have overwritten it?

@yuriks
Copy link

@yuriks yuriks commented on 17a6004 Jul 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having the same issue. PS1 has a default, and so the nicer msys2 default never gets set.

@PhilipOakley
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can someone @yuriks @toby-allsopp confirm that simply rolling back to pkgrel 1 fixes all the problems? For me, pkgrel 1 created all the problems. see #651 which sets a forced PS1 and git for window issue git-for-windows/git#794 (comment) - That is, the title bar was not being set.

@toby-allsopp
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, at least for me, the 06.1 version was fine (I get the nice default colourful prompt) and 06.2 gives me the ugly bash default prompt.

Please sign in to comment.