02 April 2013

MacPorts Upgrade Changes Bash Completion

After upgrading Macports recently to version xxx, I started seeing the following error in the terminal when the .bash_profile is loaded:
__git_ps1: command not found
Upon investigation, I discovered that the bash completion for git has been split into more than one file. Previously, all that was needed in the .bash_profile was to source the single file for git like so:
if [ -f /opt/local/etc/bash_completion ]; then
  . /opt/local/etc/bash_completion
fi
Since the update to Macports, now I also need to source the second file like so:
if [ -f /opt/local/share/git-core/contrib/completion/git-prompt.sh ]; then
  . /opt/local/share/git-core/contrib/completion/git-prompt.sh
fi
After closing/creating the terminal tab, the error is gone.

No comments:

Post a Comment