Re: [PATCH] bash completion: add space between branch name and status flags

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

 



Nanako Shiraishi <nanako3@xxxxxxxxxxx> wrote:
> Junio, could you tell us what happened to this thread?
> 
> In response to a patch from Roman Fietze to outline a better way
> to do it.  Nothing happened.

Junio responded with a suggestion on how to improve the patch when
GIT_PS1_SHOWDIRTYSTATE was not set, but Roman Fietze didn't send
a revised patch, so it got dropped.

Here is the revised patch, Junio, still think its a good idea?

--8<--
From: Roman Fietze <roman.fietze@xxxxxxxxxxxxx>
Subject: [PATCH] bash completion: add space between branch name and status flags

Improve the readability of the bash prompt by adding a space between
the branch name and the status flags (dirty, stash, untracked).

Signed-off-by: Roman Fietze <roman.fietze@xxxxxxxxxxxxx>
Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 contrib/completion/git-completion.bash |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index fbfa5f2..3c8b6df 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -163,10 +163,12 @@ __git_ps1 ()
 			fi
 		fi
 
+		local f="$w$i$s$u"
+		f="${f:+ $f}$r"
 		if [ -n "${1-}" ]; then
-			printf "$1" "$c${b##refs/heads/}$w$i$s$u$r"
+			printf "$1" "$c${b##refs/heads/}$f"
 		else
-			printf " (%s)" "$c${b##refs/heads/}$w$i$s$u$r"
+			printf " (%s)" "$c${b##refs/heads/}$f"
 		fi
 	fi
 }
-- 
1.6.6.307.gba67


-- 
Shawn.
--
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]