git/git — pull request #47 by padawin (2013-07-17 13:40:05+00:00)
Title: $r and $p are preconcatenated to $f to always display a space if $f is not empty, and no space if $f is empty

The bug:
When using __git_ps1 directly in PS1 variable, or in PROMPT_COMMAND without GIT_PS1_SHOWCOLORHINTS set,
the branch name and the upstream informations (=, <, >, <>) are not separated by a space, and
when some files are changed, added and/or stashed, there is a space to separate the branch name and its
state.

Note: This does not occur if __git_ps1 is used in PROMPT_COMMAND when GIT_PS1_SHOWCOLORHINTS is true.

Result example:
before:
user@host:/path (master=)$
after:
user@host:/path (master =)$

If a branch has no upstream and if there are no local changes, no space will be displayed.