{"thread":{"id":"3911","subject":"[PATCH] gitk: Add a visual tag for remote refs","startedAt":"2006-04-18T21:53:07Z","lastAt":"2006-04-18T21:53:07Z","messageCount":1,"participants":["Josef Weidendorfer"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"18832","messageId":"200604182353.07759.Josef.Weidendorfer@gmx.de","threadId":"3911","inReplyTo":null,"subject":"[PATCH] gitk: Add a visual tag for remote refs","fromName":"Josef Weidendorfer","fromEmail":"josef.weidendorfer@gmx.de","sentAt":"2006-04-18T21:53:07Z","receivedAt":"2006-04-18T21:53:07Z","isPatch":true,"sender":{"key":"josef.weidendorfer@gmx.de","avatar":null},"body":"This patch partly changes the background color for remote refs.\nIt makes it easy to quickly distinguish remote refs from local\ndeveloper branches.\n\nI ignore remote HEADs, as these really should be drawn as\naliases to other heads. But there is no simple way to\ndetect that HEADs really are aliases for other refs via\n\"git-ls-remote\".\n\nSigned-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>\n\n---\n\nTo see the effect of this patch, you need remote refs in your\nrepository. Such refs are created when using \"--use-separate-remote\"\nwith git-clone.\n\nIMHO showing HEAD refs as aliases to real refs would be nice to\nhave in gitk (What is the current branch?). Unfortunately,\n\"git-ls-remote\", which is used in gitk, does not give the info\nwhether a ref is a symbolic link to another.\nSo for this time, I ignore remote HEADs, too. They are only confusing\nas they would have been drawn now.\n\nJosef\n\n\n gitk |   14 ++++++++++++++\n 1 files changed, 14 insertions(+), 0 deletions(-)\n\nf073dd11d6f2d473797b4c85cd4ac9758b6141b6\ndiff --git a/gitk b/gitk\nindex 87e7162..b642326 100755\n--- a/gitk\n+++ b/gitk\n@@ -290,10 +290,16 @@ proc readrefs {} {\n \t    match id path]} {\n \t    continue\n \t}\n+\tif {[regexp {^remotes/.*/HEAD$} $path match]} {\n+\t    continue\n+\t}\n \tif {![regexp {^(tags|heads)/(.*)$} $path match type name]} {\n \t    set type others\n \t    set name $path\n \t}\n+\tif {[regexp {^remotes/} $path match]} {\n+\t    set type heads\n+\t}\n \tif {$type == \"tags\"} {\n \t    set tagids($name) $id\n \t    lappend idtags($id) $name\n@@ -1718,6 +1724,14 @@ proc drawtags {id x xt y1} {\n \t    set xl [expr {$xl - $delta/2}]\n \t    $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \\\n \t\t-width 1 -outline black -fill $col -tags tag.$id\n+\t    if {[regexp {^(remotes/.*/|remotes/)} $tag match remoteprefix]} {\n+\t        set rwid [font measure $mainfont $remoteprefix]\n+\t\tset xi [expr {$x + 1}]\n+\t\tset yti [expr {$yt + 1}]\n+\t\tset xri [expr {$x + $rwid}]\n+\t\t$canv create polygon $xi $yti $xri $yti $xri $yb $xi $yb \\\n+\t\t\t-width 0 -fill \"#ffddaa\" -tags tag.$id\n+\t    }\n \t}\n \tset t [$canv create text $xl $y1 -anchor w -text $tag \\\n \t\t   -font $mainfont -tags tag.$id]\n-- \n1.3.0.rc4.g8060-dirty\n"}]}