Environment is borked after running `homesick cd`
nomicode opened this issue · 6 comments
Steps to reproduce:
Put this in your ~/.bash_profile
file:
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
GIT_PS1_SHOWDIRTYSTATE=true
PS1='\u@\h \w$(__git_ps1 " (%s)") \[\e[m\]$ '
export PS1
fi
Now run:
homesick cd YOUR_REPO
You will get the following error:
bash: __git_ps1: command not found
This appears every time you enter a new command in the new shell.
I see this:
$ homesick cd dotfiles
cd /Users/nslater/.homesick/repos/dotfiles Opening a new shell in castle 'dotfiles'. To return to the original one exit from the new shell.
bash: __git_ps1: command not found
$ echo
bash: __git_ps1: command not found
I wrote the code myself, I think. It checks for the presence of that files, and sources it if it exists. The __git_ps1
function is made available to the $PS1 variable via that file.
What I think must be happening is that the new shell that homesick opens is not sourcing my ~/.bash_profile
file at all. Because other configurations I have set up, such as aliases, are not available.
Oh, and I am using bash 3.2.51 and homesick 1.0.0.
What happens when you source it manually, a la source ~/.bash_profile
? Does this solve the problem temporarily? It almost seems like this could be stemming from bash's default sourcing behavior, not homesick (although I could be mistaken).
If I source it manually, it fixes it while I am in the new shell.
It sounds like your problem is with bash rather than homesick. Check out my link above for a workaround.
That fixed it. Thanks!