{"thread":{"id":"20482","subject":"[PATCH] gitk: parse arbitrary commit-ish in SHA1 field","startedAt":"2009-08-08T14:56:11Z","lastAt":"2009-08-13T11:54:40Z","messageCount":4,"participants":["Thomas Rast","Junio C Hamano","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"119987","messageId":"f7e6f82a33aa8496de81262d641953534089e980.1249742874.git.trast@student.ethz.ch","threadId":"20482","inReplyTo":null,"subject":"[PATCH] gitk: parse arbitrary commit-ish in SHA1 field","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-08-08T14:56:11Z","receivedAt":"2009-08-08T14:56:11Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"We only accepted either SHA1s or heads/tags that have been read.  This\nmeant the user could not, e.g., enter HEAD to go back to the current\ncommit.\n\nAdd code to call out to git-rev-parse with the string entered if all\nother methods of interpreting it failed.  The error paths change\nslighly, because we now know from the rev-parse invocation whether the\nexpression was valid at all.  The previous \"unknown\" path is now only\ntriggered if the revision does exist, but is not in the current view\ndisplay.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n\nOf course, *ideally* we'd resort to *changing* the current view so\nthat it also lists the requested commit.  But my Tk-fu is currently\nnot up to that task.\n\n\n gitk |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 4604c83..4b27886 100755\n--- a/gitk\n+++ b/gitk\n@@ -7906,6 +7906,11 @@ proc gotocommit {} {\n \t\t}\n \t\tset id [lindex $matches 0]\n \t    }\n+\t} else {\n+\t    if {[catch {set id [exec git rev-parse $sha1string]}]} {\n+\t\terror_popup [mc \"Revision %s is not known\" $sha1string]\n+\t\treturn\n+\t    }\n \t}\n     }\n     if {[commitinview $id $curview]} {\n@@ -7915,7 +7920,7 @@ proc gotocommit {} {\n     if {[regexp {^[0-9a-fA-F]{4,}$} $sha1string]} {\n \tset msg [mc \"SHA1 id %s is not known\" $sha1string]\n     } else {\n-\tset msg [mc \"Tag/Head %s is not known\" $sha1string]\n+\tset msg [mc \"Revision %s is not in the current view\" $sha1string]\n     }\n     error_popup $msg\n }\n-- \n1.6.4.199.g24c3\n"},{"id":"120230","messageId":"7vtz0fndak.fsf@alter.siamese.dyndns.org","threadId":"20482","inReplyTo":"f7e6f82a33aa8496de81262d641953534089e980.1249742874.git.trast@student.ethz.ch","subject":"Re: [PATCH] gitk: parse arbitrary commit-ish in SHA1 field","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-11T05:13:23Z","receivedAt":"2009-08-11T05:13:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Rast <trast@student.ethz.ch> writes:\n\n> +\t} else {\n> +\t    if {[catch {set id [exec git rev-parse $sha1string]}]} {\n\n\"--verify\", or \"--no-flags --revs-only\"?  Examples of possible bad input\nstrings that you may otherwise not catch are:\n\n\tmaster..\n        --merge -- a\n"},{"id":"120496","messageId":"c3c4afa39354da6df5a0b17ee43eb4e8dfcfb099.1250148240.git.trast@student.ethz.ch","threadId":"20482","inReplyTo":"7vtz0fndak.fsf@alter.siamese.dyndns.org","subject":"[PATCH v2] gitk: parse arbitrary commit-ish in SHA1 field","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-08-13T07:25:03Z","receivedAt":"2009-08-13T07:25:03Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"We only accepted either SHA1s or heads/tags that have been read.  This\nmeant the user could not, e.g., enter HEAD to go back to the current\ncommit.\n\nAdd code to call out to git rev-parse --verify with the string entered\nif all other methods of interpreting it failed.  (git-rev-parse alone\nis not enough as we really want a single revision.)\n\nThe error paths change slighly, because we now know from the rev-parse\ninvocation whether the expression was valid at all.  The previous\n\"unknown\" path is now only triggered if the revision does exist, but\nis not in the current view display.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n\nJunio C Hamano wrote:\n> > +     } else {\n> > +         if {[catch {set id [exec git rev-parse $sha1string]}]} {\n> \n> \"--verify\", or \"--no-flags --revs-only\"?\n\nIndeed, thanks.\n\n\n gitk |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 4604c83..e50b666 100755\n--- a/gitk\n+++ b/gitk\n@@ -7906,6 +7906,11 @@ proc gotocommit {} {\n \t\t}\n \t\tset id [lindex $matches 0]\n \t    }\n+\t} else {\n+\t    if {[catch {set id [exec git rev-parse --verify $sha1string]}]} {\n+\t\terror_popup [mc \"Revision %s is not known\" $sha1string]\n+\t\treturn\n+\t    }\n \t}\n     }\n     if {[commitinview $id $curview]} {\n@@ -7915,7 +7920,7 @@ proc gotocommit {} {\n     if {[regexp {^[0-9a-fA-F]{4,}$} $sha1string]} {\n \tset msg [mc \"SHA1 id %s is not known\" $sha1string]\n     } else {\n-\tset msg [mc \"Tag/Head %s is not known\" $sha1string]\n+\tset msg [mc \"Revision %s is not in the current view\" $sha1string]\n     }\n     error_popup $msg\n }\n-- \n1.6.4.269.g0449d\n"},{"id":"120512","messageId":"19075.65280.288895.139503@cargo.ozlabs.ibm.com","threadId":"20482","inReplyTo":"c3c4afa39354da6df5a0b17ee43eb4e8dfcfb099.1250148240.git.trast@student.ethz.ch","subject":"Re: [PATCH v2] gitk: parse arbitrary commit-ish in SHA1 field","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2009-08-13T11:54:40Z","receivedAt":"2009-08-13T11:54:40Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Thomas Rast writes:\n\n> We only accepted either SHA1s or heads/tags that have been read.  This\n> meant the user could not, e.g., enter HEAD to go back to the current\n> commit.\n> \n> Add code to call out to git rev-parse --verify with the string entered\n> if all other methods of interpreting it failed.  (git-rev-parse alone\n> is not enough as we really want a single revision.)\n> \n> The error paths change slighly, because we now know from the rev-parse\n> invocation whether the expression was valid at all.  The previous\n> \"unknown\" path is now only triggered if the revision does exist, but\n> is not in the current view display.\n> \n> Signed-off-by: Thomas Rast <trast@student.ethz.ch>\n\nThanks, applied.\n\nPaul.\n"}]}