Skip to content

Commit

Permalink
[PATCH] gitk: Add a visual tag for remote refs
Browse files Browse the repository at this point in the history
This patch partly changes the background color for remote refs.
It makes it easy to quickly distinguish remote refs from local
developer branches.

I ignore remote HEADs, as these really should be drawn as
aliases to other heads. But there is no simple way to
detect that HEADs really are aliases for other refs via
"git-ls-remote".

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Josef Weidendorfer authored and Paul Mackerras committed Apr 25, 2006
1 parent 61e56c8 commit a970fcf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions gitk
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,16 @@ proc readrefs {} {
match id path]} {
continue
}
if {[regexp {^remotes/.*/HEAD$} $path match]} {
continue
}
if {![regexp {^(tags|heads)/(.*)$} $path match type name]} {
set type others
set name $path
}
if {[regexp {^remotes/} $path match]} {
set type heads
}
if {$type == "tags"} {
set tagids($name) $id
lappend idtags($id) $name
Expand Down Expand Up @@ -1702,6 +1708,14 @@ 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]} {
set rwid [font measure $mainfont $remoteprefix]
set xi [expr {$x + 1}]
set yti [expr {$yt + 1}]
set xri [expr {$x + $rwid}]
$canv create polygon $xi $yti $xri $yti $xri $yb $xi $yb \
-width 0 -fill "#ffddaa" -tags tag.$id
}
}
set t [$canv create text $xl $y1 -anchor w -text $tag \
-font $mainfont -tags tag.$id]
Expand Down

0 comments on commit a970fcf

Please sign in to comment.