Skip to content

Commit 28f96e0

Browse files
committed
gitk: fix highlighted remote prefix of branches with directories
The decoration of a remote ref is colored in two parts: (1) the prefix that mentions the remove (including "remote/"); and (2) the branch name. To extract the prefix from the ref name, a regular expression is used. However, the expression is not restrictive enough: it picks everything before the last slash character as prefix, so that, for example, the ref name "remotes/orgin/ml/themes" is split into "remotes/origin/ml" and "themes". Tighten the regular expression so that only the name of the remote is pulled into the prefix, but no part of the branch name. This gives the desired result in the example: "remotes/origin" and "ml/themes". Signed-off-by: Johannes Sixt <j6t@kdbg.org>
1 parent 776223c commit 28f96e0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

gitk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6841,7 +6841,7 @@ proc drawtags {id x xt y1} {
68416841
set xl [expr {$xl - $delta/2}]
68426842
$canv create polygon $x $yt $xr $yt $xr $yb $x $yb \
68436843
-width 1 -outline black -fill $col -tags tag.$id
6844-
if {[regexp {^(remotes/.*/|remotes/)} $tag match remoteprefix]} {
6844+
if {[regexp {^(remotes/[^/]*/|remotes/)} $tag match remoteprefix]} {
68456845
set rwid [font measure mainfont $remoteprefix]
68466846
set xi [expr {$x + 1}]
68476847
set yti [expr {$yt + 1}]

0 commit comments

Comments
 (0)