[PATCH] completion: Add space to PS1 when showing upstream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Depending on whether other changes were present or displayed in PS1, the
prompt may have lacked a space between the branch and the upstream
marker.  Add this space as needed so the branch name and upstream state
aren't confusingly mixed.

Signed-off-by: Todd Zullinger <tmz@xxxxxxxxx>
---
 contrib/completion/git-completion.bash |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 0b0b913..e5af5f6 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -312,6 +312,7 @@ __git_ps1 ()
 		fi
 
 		local f="$w$i$s$u"
+		[[ -z $f ]] && p="${p:+ $p}"
 		printf "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r$p"
 	fi
 }
-- 
1.7.4.1

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Giving money and power to government is like giving whiskey and car
keys to teenage boys.
    -- P.J. O'Rourke

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]