Add custom git info to PS1

The regular __git_ps1 checks the local git config each time it decides
whether to show dirty state.  This is pretty much always slower than
just showing it, even for massive repositories, so we import and modify
git-prompt.sh ourselves.

Also add some custom coloring and flags.