This will not exactly address the original question context, but might be useful for newer Ubuntu users migrating from older versions...
I recently upgraded an old Ubuntu 12.04 machine to newer version of Ubuntu and I started seeing errors about __git_dir missing due to my PS1 settings like explained by the other answers. To understand why this shell function was not any more defined I figured my .bashrc was not up-to-date with the newer Ubuntu conventions.
My old .bashrc that was based on the one originally provided by old Ubuntu system had something similar to this:
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
while .bashrc files created by newer Ubuntu systems first try to use /usr/share/bash-completion/bash_completion:
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
When I replaced the old bash completion sourcing with the newer one, I got __git_dir defined and was happy ever after.