{"thread":{"id":"29132","subject":"[PATCH] gitk: make \"git describe\" output clickable, too","startedAt":"2011-12-10T15:08:57Z","lastAt":"2012-02-01T13:17:13Z","messageCount":3,"participants":["Jim Meyering","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"180799","messageId":"87mxb0foqe.fsf@rho.meyering.net","threadId":"29132","inReplyTo":null,"subject":"[PATCH] gitk: make \"git describe\" output clickable, too","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2011-12-10T15:08:57Z","receivedAt":"2011-12-10T15:08:57Z","isPatch":true,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"\nI noticed that automake's contribution guidelines suggest using\n\"git describe\" output in commit logs to reference previous commits.\nBy contrast, in coreutils, I had acquired the habit of using a bare SHA1\nprefix (8 hex digits), since gitk creates clickable links for that, and\nnot for \"git describe\" output.\n\nI prefer the readability of the full \"git describe\" output, yet want to\nretain the gitk links, so wrote the following that renders as clickable\nnot just SHA1-like strings, but also an SHA1-like string that is\nprefixed by \"-g\".\n\nSigned-off-by: Jim Meyering <meyering@redhat.com>\n---\nThis is relative to master.\nThink of this as mere proof-of-concept:\n\nIdeally, the string preceding the -g would be used to disambiguate\nthe SHA1 prefix, but that would require more code.\n\nI confess that I haven't looked to see if documentation needs\nto be updated or if this would merit test suite additions.\n\n gitk-git/gitk |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 4cde0c4..f8eb613 100755\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -6688,7 +6688,7 @@ proc appendwithlinks {text tags} {\n\n     set start [$ctext index \"end - 1c\"]\n     $ctext insert end $text $tags\n-    set links [regexp -indices -all -inline {\\m[0-9a-f]{6,40}\\M} $text]\n+    set links [regexp -indices -all -inline {(?:\\m|-g)[0-9a-f]{6,40}\\M} $text]\n     foreach l $links {\n \tset s [lindex $l 0]\n \tset e [lindex $l 1]\n@@ -6704,6 +6704,10 @@ proc appendwithlinks {text tags} {\n proc setlink {id lk} {\n     global curview ctext pendinglinks\n\n+    if {[string range $id 0 1] eq \"-g\"} {\n+      set id [string range $id 2 end]\n+    }\n+\n     set known 0\n     if {[string length $id] < 40} {\n \tset matches [longid $id]\n--\n1.7.8.163.g9859a\n"},{"id":"180956","messageId":"7v62hl4llk.fsf@alter.siamese.dyndns.org","threadId":"29132","inReplyTo":"87mxb0foqe.fsf@rho.meyering.net","subject":"Re: [PATCH] gitk: make \"git describe\" output clickable, too","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-12-12T19:48:55Z","receivedAt":"2011-12-12T19:48:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jim Meyering <jim@meyering.net> writes:\n\n> I noticed that automake's contribution guidelines suggest using\n> \"git describe\" output in commit logs to reference previous commits.\n> By contrast, in coreutils, I had acquired the habit of using a bare SHA1\n> prefix (8 hex digits), since gitk creates clickable links for that, and\n> not for \"git describe\" output.\n>\n> I prefer the readability of the full \"git describe\" output, yet want to\n> retain the gitk links, so wrote the following that renders as clickable\n> not just SHA1-like strings, but also an SHA1-like string that is\n> prefixed by \"-g\".\n>\n> Signed-off-by: Jim Meyering <meyering@redhat.com>\n> ---\n> This is relative to master.\n> Think of this as mere proof-of-concept:\n\nPaul, I think this makes tons of sense. Comments?\n\n> Ideally, the string preceding the -g would be used to disambiguate\n> the SHA1 prefix, but that would require more code.\n>\n> I confess that I haven't looked to see if documentation needs\n> to be updated or if this would merit test suite additions.\n>\n>  gitk-git/gitk |    6 +++++-\n>  1 files changed, 5 insertions(+), 1 deletions(-)\n>\n> diff --git a/gitk-git/gitk b/gitk-git/gitk\n> index 4cde0c4..f8eb613 100755\n> --- a/gitk-git/gitk\n> +++ b/gitk-git/gitk\n> @@ -6688,7 +6688,7 @@ proc appendwithlinks {text tags} {\n>\n>      set start [$ctext index \"end - 1c\"]\n>      $ctext insert end $text $tags\n> -    set links [regexp -indices -all -inline {\\m[0-9a-f]{6,40}\\M} $text]\n> +    set links [regexp -indices -all -inline {(?:\\m|-g)[0-9a-f]{6,40}\\M} $text]\n>      foreach l $links {\n>  \tset s [lindex $l 0]\n>  \tset e [lindex $l 1]\n> @@ -6704,6 +6704,10 @@ proc appendwithlinks {text tags} {\n>  proc setlink {id lk} {\n>      global curview ctext pendinglinks\n>\n> +    if {[string range $id 0 1] eq \"-g\"} {\n> +      set id [string range $id 2 end]\n> +    }\n> +\n>      set known 0\n>      if {[string length $id] < 40} {\n>  \tset matches [longid $id]\n> --\n> 1.7.8.163.g9859a\n"},{"id":"183470","messageId":"871uqeelra.fsf@rho.meyering.net","threadId":"29132","inReplyTo":"7v62hl4llk.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] gitk: make \"git describe\" output clickable, too","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2012-02-01T13:17:13Z","receivedAt":"2012-02-01T13:17:13Z","isPatch":true,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"Junio C Hamano wrote:\n> Jim Meyering <jim@meyering.net> writes:\n>\n>> I noticed that automake's contribution guidelines suggest using\n>> \"git describe\" output in commit logs to reference previous commits.\n>> By contrast, in coreutils, I had acquired the habit of using a bare SHA1\n>> prefix (8 hex digits), since gitk creates clickable links for that, and\n>> not for \"git describe\" output.\n>>\n>> I prefer the readability of the full \"git describe\" output, yet want to\n>> retain the gitk links, so wrote the following that renders as clickable\n>> not just SHA1-like strings, but also an SHA1-like string that is\n>> prefixed by \"-g\".\n>>\n>> Signed-off-by: Jim Meyering <meyering@redhat.com>\n>> ---\n>> This is relative to master.\n>> Think of this as mere proof-of-concept:\n>\n> Paul, I think this makes tons of sense. Comments?\n\nThanks for the feedback, Junio.\n\n>> Ideally, the string preceding the -g would be used to disambiguate\n>> the SHA1 prefix, but that would require more code.\n>>\n>> I confess that I haven't looked to see if documentation needs\n>> to be updated or if this would merit test suite additions.\n>>\n>>  gitk-git/gitk |    6 +++++-\n>>  1 files changed, 5 insertions(+), 1 deletions(-)\n>>\n>> diff --git a/gitk-git/gitk b/gitk-git/gitk\n>> index 4cde0c4..f8eb613 100755\n>> --- a/gitk-git/gitk\n>> +++ b/gitk-git/gitk\n>> @@ -6688,7 +6688,7 @@ proc appendwithlinks {text tags} {\n>>\n>>      set start [$ctext index \"end - 1c\"]\n>>      $ctext insert end $text $tags\n>> -    set links [regexp -indices -all -inline {\\m[0-9a-f]{6,40}\\M} $text]\n>> +    set links [regexp -indices -all -inline {(?:\\m|-g)[0-9a-f]{6,40}\\M} $text]\n>>      foreach l $links {\n>>  \tset s [lindex $l 0]\n>>  \tset e [lindex $l 1]\n>> @@ -6704,6 +6704,10 @@ proc appendwithlinks {text tags} {\n>>  proc setlink {id lk} {\n>>      global curview ctext pendinglinks\n>>\n>> +    if {[string range $id 0 1] eq \"-g\"} {\n>> +      set id [string range $id 2 end]\n>> +    }\n>> +\n>>      set known 0\n>>      if {[string length $id] < 40} {\n>>  \tset matches [longid $id]\n>> --\n>> 1.7.8.163.g9859a\n"}]}