Skip to content

Commit 6c9e2d1

Browse files
meyeringpaulusmack
authored andcommitted
gitk: Make "git describe" output clickable, too
Automake's contribution guidelines suggest using "git describe" output in commit logs to reference previous commits. By contrast, in coreutils, I had acquired the habit of using a bare SHA1 prefix (8 hex digits), since gitk creates clickable links for that, and not for "git describe" output. I prefer the readability of the full "git describe" output, yet want to retain the gitk links, so this renders as clickable not just SHA1-like strings, but also an SHA1-like string that is prefixed by "-g". Signed-off-by: Jim Meyering <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 65bb0bd commit 6c9e2d1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

gitk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6734,7 +6734,7 @@ proc appendwithlinks {text tags} {
67346734

67356735
set start [$ctext index "end - 1c"]
67366736
$ctext insert end $text $tags
6737-
set links [regexp -indices -all -inline {\m[0-9a-f]{6,40}\M} $text]
6737+
set links [regexp -indices -all -inline {(?:\m|-g)[0-9a-f]{6,40}\M} $text]
67386738
foreach l $links {
67396739
set s [lindex $l 0]
67406740
set e [lindex $l 1]
@@ -6750,6 +6750,10 @@ proc appendwithlinks {text tags} {
67506750
proc setlink {id lk} {
67516751
global curview ctext pendinglinks
67526752

6753+
if {[string range $id 0 1] eq "-g"} {
6754+
set id [string range $id 2 end]
6755+
}
6756+
67536757
set known 0
67546758
if {[string length $id] < 40} {
67556759
set matches [longid $id]

0 commit comments

Comments
 (0)