t9903: Add tests for git-prompt pcmode

git-prompt.sh was missing tests for PROMPT_COMMAND
mode.

Add tests for:
* prompt without color
* prompt with colors in bash
* prompt with colors in zsh

Having these tests will enable an upcoming refactor
in a safe way.
git-prompt.sh: refactor colored prompt code

Remove duplication of logic to build gitstring.

__git_ps1_colorize_gitstring() sets color codes and
builds the prompt gitstring. It has duplicated code
to handle color codes in bash and zsh shells.
__git_ps1() also has duplicated logic to build the
prompt gitstring.

Remove duplication of logic to build gitstring in
__git_ps1_colorize_gitstring() and __git_ps1().

Leave in __git_ps1_colorize_gitstring() only logic to set color codes.
git-prompt.sh: Enable color prompt in non-pcmode

The use of colors in a prompt is only possible in
pcmode (using the variable PROMPT_COMMAND).

Make color prompt work in non-pcmode (using the
variable PS1) for both Bash and ZSH.