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
bash.bashrc: Update PS1 if PS1 wasn't exported. #654
Conversation
@Karlson2k Many thanks. That does appear to fix the G4W SDK (I've only done a Also the start paths differ (correctly) of "/" vs "~". Many thanks. |
@Alexpux Just to say I spoke too soon, and while my initial monkey patch fix git-for-windows/build-extra#122. to G4W still works, reverting that fix doesn't (I reinstalled the SDK from scratch to check, which I hope was sufficient). What's not clear to me is whether you require that PS1 settings should be exported by/from the bash.bashrc, or whether they should propagate naturally. There appears to be far more nuance in that part of the set up than I currently understand (and lots of stackexchange questions on the subject). Half the web instructions for setting PS1 don't say Do you require/expect that all PS1 settings should be exported? |
@PhilipOakley Sorry, didn't get. If you export your |
@Karlson2k, thanks for getting back. In git for windows, and the G4W SDK, the PS1 is set within the bash.bashrc file (inserted at the end by an install patch) by dot sourcing a git-prompt.sh script (the link is to the one with my monkey patch). That PS1 string does two things, first it sets a TITLEPREFIX for the window (so one can tell which window (SDK or MinGW) is which!), and second, adds the regular __git_ps1 promt function to also show the current checked out branch etc. Note that it doesn't export the PS1. I don't (personally) set the PS1 at all (to the best of my knowledge). As I understand it, you/we shouldn't need to export the PS1 from the bash.bashrc (and files it dot sources) because all subsequent interactive shells will invoke it anyway, so the PS1 will be set anyway e.g. this explicit comment What I'm seeing is that my window title bars are not displaying the TITLEPREFIX, indicating 'something has gone wrong'. That was the root cause of all these issues way back at dschos comment, which is where I noticed the 'fix' by renatosilva. It's seems like we've been digging holes from that point. While my monkey patch fix to G4W (mentioned above) fixed the issue on the surface, I tried to understand and fix the base issue (and probably making some mistakes on the way). At the moment I'm still not sure what the root cause was, and if it's fixed. Additionally, I know that G4W does a liitle bit of a two-step when starting to get the mintty window going properly, and there are comments in the release notes about needing So, all in all, things aren't as clear as they could be. For example,
(for the first two I've shown what I think my reseach tells me) |
Should fix regression introduced by #651
bash use some default value for PS1, but this value is not exported. This allow us to distinguish between user-defined PS1 and bash automatic default PS1.