{"thread":{"id":"673","subject":"[PATCH] cg-log: make -r id:id show the given id instead of nothing","startedAt":"2005-05-20T15:04:00Z","lastAt":"2005-05-29T13:07:20Z","messageCount":3,"participants":["Jonas Fonseca","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"3614","messageId":"20050520150400.GC27395@diku.dk","threadId":"673","inReplyTo":null,"subject":"[PATCH] cg-log: make -r id:id show the given id instead of nothing","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2005-05-20T15:04:00Z","receivedAt":"2005-05-20T15:04:00Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"If cg-log is passed -r cogito-0.10 -r cogito-0.10 no log entries are\nshown. This patch make it show the log for the given ID.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n\nIndex: cg-log\n===================================================================\n--- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/cg-log  (mode:100755)\n+++ uncommitted/cg-log  (mode:100755)\n@@ -113,6 +113,9 @@\n if [ \"$log_end\" ]; then\n \tid1=\"$(commit-id $log_start)\" || exit 1\n \tid2=\"$(commit-id $log_end)\" || exit 1\n+\tif [ \"$id1\" = \"$id2\" ]; then\n+\t\tid1=$(git-cat-file commit $id1 | sed -n '/^parent /,0s/parent //p')\n+\tfi\n \trevls=\"git-rev-tree $id2 ^$id1\"\n \trevsort=\"sort -rn\"\n \trevfmt=\"git-rev-tree\"\n-- \nJonas Fonseca\n"},{"id":"4165","messageId":"20050529121910.GG1036@pasky.ji.cz","threadId":"673","inReplyTo":"20050520150400.GC27395@diku.dk","subject":"Re: [PATCH] cg-log: make -r id:id show the given id instead of nothing","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-29T12:19:10Z","receivedAt":"2005-05-29T12:19:10Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Fri, May 20, 2005 at 05:04:00PM CEST, I got a letter\nwhere Jonas Fonseca <fonseca@diku.dk> told me that...\n> If cg-log is passed -r cogito-0.10 -r cogito-0.10 no log entries are\n> shown. This patch make it show the log for the given ID.\n> \n> Signed-off-by: Jonas Fonseca <fonseca@diku.dk>\n\nI don't like such a special case a lot. If you just want to make it\npossible to show up just a single revision by cg-log, what about -R or\nsomething, so that you don't need to write it twice?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"4167","messageId":"20050529130719.GA16291@diku.dk","threadId":"673","inReplyTo":"20050529121910.GG1036@pasky.ji.cz","subject":"Re: [PATCH] cg-log: make -r id:id show the given id instead of nothing","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2005-05-29T13:07:20Z","receivedAt":"2005-05-29T13:07:20Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Petr Baudis <pasky@ucw.cz> wrote Sun, May 29, 2005:\n> Dear diary, on Fri, May 20, 2005 at 05:04:00PM CEST, I got a letter\n> where Jonas Fonseca <fonseca@diku.dk> told me that...\n> > If cg-log is passed -r cogito-0.10 -r cogito-0.10 no log entries are\n> > shown. This patch make it show the log for the given ID.\n> > \n> > Signed-off-by: Jonas Fonseca <fonseca@diku.dk>\n> \n> I don't like such a special case a lot. If you just want to make it\n> possible to show up just a single revision by cg-log, what about -R or\n> something, so that you don't need to write it twice?\n\nI admit it is a bit weird. The reason for this was to make support for\nspecifying revisions with something as fuzzy as dates more usable.\nOriginally I modified commit-id to support it, but I've tried to move\nthe logic to the new cg-Xnormid to just give an idea. It is suppose to\nadd support for\n\n\t$ cg-log -r '2005-05-12':'1 day ago'\n\nbut for some reason it seems to only work as expected for commits by\nyou. That is it works as expected when I specify the dates for\ncogito-0.9 and cogito-0.10.\n\nOf course supporting revisions via date specifications can lead to\nambiguity problems when the date contains `HH:MM' because the colon can\nconfuse -r option parsing. This means that either a new option needs to\nbe added (-D?) or the rev1:rev2 case has to be handled after all options\nhas been parsed so that `-r date1 -r date2' can be handled correctly.\n\nIndex: cg-Xnormid\n===================================================================\n--- c8e987e5e4608c1144293cd3f852210d70b572cb/cg-Xnormid  (mode:100755)\n+++ uncommitted/cg-Xnormid  (mode:100755)\n@@ -40,6 +40,14 @@\n \tfi\n fi\n \n+if [ ${#id} -ne 40 ] || [ ! -f .git/objects/${id:0:2}/${id:2} ]; then\n+\treqsecs=$(date --date=\"$id\" +'%s' 2>/dev/null)\n+\n+\tif [ \"$reqsecs\" ]; then\n+\t\tid=$(git-rev-list --min-age=$reqsecs --max-count=1 HEAD)\n+\tfi\n+fi\n+\n # If we don't have a 40-char ID by now, it's an error\n if [ ${#id} -ne 40 ] || [ ! -f .git/objects/${id:0:2}/${id:2} ]; then\n \techo \"Invalid id: $id\" >&2\n-- \nJonas Fonseca\n"}]}