[PATCH] gitk: Fix how remote branch names with / are drawn

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

 



Consider this example branch:

remotes/origin/master

gitk displays this branch with different background colors for each part:
"remotes/origin" in orange and "master" in green. The idea is to make it
visually easy to read the branch name separately from the remote name.

However this fails when given this example branch:

remotes/origin/foo/bar

gitk displays this branch with "remotes/origin/foo" in orange and "bar" in
green. This makes it hard to read the branch name "foo/bar". This is due
to an inappropriately greedy regexp. This patch provides a fix so the same
branch will now be displayed with "remotes/origin" in orange and "foo/bar"
in green.

Signed-off-by: David Holmer <odinguru@xxxxxxxxx>
---
 gitk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gitk b/gitk
index 805a1c7..ca2392b 100755
--- a/gitk
+++ b/gitk
@@ -6640,7 +6640,7 @@ proc drawtags {id x xt y1} {
 	    set xl [expr {$xl - $delta/2}]
 	    $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \
 		-width 1 -outline black -fill $col -tags tag.$id
-	    if {[regexp {^(remotes/.*/|remotes/)} $tag match remoteprefix]} {
+	    if {[regexp {^(remotes/[^/]*/|remotes/)} $tag match remoteprefix]} {
 	        set rwid [font measure mainfont $remoteprefix]
 		set xi [expr {$x + 1}]
 		set yti [expr {$yt + 1}]
-- 
1.9.1

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