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 <meyering@redhat.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Jim Meyering committed
Dec 10, 2011 at 16:08 UTC
6c9e2d1842c8ab6e283df8633b42254fc1e2fcc6
1 file changed
+5
-1
gitk
+5
-1
@@ -6734,7 +6734,7 @@ proc appendwithlinks {text tags} {
6734
6735
set start [$ctext index "end - 1c"]
6736
$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]
6738
foreach l $links {
6739
set s [lindex $l 0]
6740
set e [lindex $l 1]
@@ -6750,6 +6750,10 @@ proc appendwithlinks {text tags} {
6750
proc setlink {id lk} {
6751
global curview ctext pendinglinks
6752
6753
+ if {[string range $id 0 1] eq "-g"} {
6754
+ set id [string range $id 2 end]
6755
+ }
6756
+
6757
set known 0
6758
if {[string length $id] < 40} {
6759
set matches [longid $id]