{"thread":{"id":"27518","subject":"git annotate with date option not working?","startedAt":"2011-06-01T08:20:37Z","lastAt":"2011-06-01T19:37:04Z","messageCount":9,"participants":["Chengwei Ding","Jakub Narebski","Arnaud Lacurie","Jeff King","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"169100","messageId":"4DE5F655.9020400@gmail.com","threadId":"27518","inReplyTo":null,"subject":"git annotate with date option not working?","fromName":"Chengwei Ding","fromEmail":"waterding@gmail.com","sentAt":"2011-06-01T08:20:37Z","receivedAt":"2011-06-01T08:20:37Z","isPatch":false,"sender":{"key":"waterding@gmail.com","avatar":null},"body":"hello,\n\ncan anyone confirm that this \"--date\" option is working for git annotate \ncmd.\n\ni tried the same option on blame cmd which seems to be working, but not \non the annotate which i use git annotate --date=relative or i wrote date \nconfig variable as blame.date which again work for blame but not \nannotate, but document says it should share same variable.\n\nmy env:\nubuntu 11.04 64\ngit ppa source 1.7.5.2\n\nRegards\n"},{"id":"169104","messageId":"m3aae1yjnm.fsf@localhost.localdomain","threadId":"27518","inReplyTo":"4DE5F655.9020400@gmail.com","subject":"Re: git annotate with date option not working?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2011-06-01T09:40:51Z","receivedAt":"2011-06-01T09:40:51Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Chengwei Ding <waterding@gmail.com> writes:\n\n> can anyone confirm that this \"--date\" option is working for git\n> annotate cmd.\n> \n> i tried the same option on blame cmd which seems to be working, but\n> not on the annotate which i use git annotate --date=relative or i\n> wrote date config variable as blame.date which again work for blame\n> but not annotate, but document says it should share same variable.\n\n\"git annotate\" is left for backwards compatibility, so it might be\nthat not all git-blame switches work correctly with it.  \n\nDoes \"git blame -c --date=relative\" work?\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"169105","messageId":"BANLkTik2bTqScNLRwRwdz3h=cPJJxX6v2Q@mail.gmail.com","threadId":"27518","inReplyTo":"4DE5F655.9020400@gmail.com","subject":"Re: git annotate with date option not working?","fromName":"Arnaud Lacurie","fromEmail":"arnaud.lacurie@gmail.com","sentAt":"2011-06-01T09:41:12Z","receivedAt":"2011-06-01T09:41:12Z","isPatch":false,"sender":{"key":"arnaud.lacurie@gmail.com","avatar":null},"body":"Hi,\n\n> can anyone confirm that this \"--date\" option is working for git annotate\n> cmd.\n\nI tried 'git annotate --date=relative <onefile>' and it works perfectly here.\ngit version 1.7.4.1\nubuntu 11.04\n\nIt works also well on the git version 1.7.5.3.401.gfb674 (The latest on master)\n\nRegards\n\n-- \nArnaud Lacurie\n"},{"id":"169109","messageId":"4DE63127.60903@gmail.com","threadId":"27518","inReplyTo":"m3aae1yjnm.fsf@localhost.localdomain","subject":"Re: git annotate with date option not working?","fromName":"Chengwei Ding","fromEmail":"waterding@gmail.com","sentAt":"2011-06-01T12:31:35Z","receivedAt":"2011-06-01T12:31:35Z","isPatch":false,"sender":{"key":"waterding@gmail.com","avatar":null},"body":"On 06/01/2011 11:40 AM, Jakub Narebski wrote:\n> Chengwei Ding<waterding@gmail.com>  writes:\n>\n>> can anyone confirm that this \"--date\" option is working for git\n>> annotate cmd.\n>>\n>> i tried the same option on blame cmd which seems to be working, but\n>> not on the annotate which i use git annotate --date=relative or i\n>> wrote date config variable as blame.date which again work for blame\n>> but not annotate, but document says it should share same variable.\n> \"git annotate\" is left for backwards compatibility, so it might be\n> that not all git-blame switches work correctly with it.\n>\n> Does \"git blame -c --date=relative\" work?\n>\nemm, no luck.\n\n//Chengwei\n"},{"id":"169110","messageId":"4DE6319A.5020808@gmail.com","threadId":"27518","inReplyTo":"BANLkTik2bTqScNLRwRwdz3h=cPJJxX6v2Q@mail.gmail.com","subject":"Re: git annotate with date option not working?","fromName":"Chengwei Ding","fromEmail":"waterding@gmail.com","sentAt":"2011-06-01T12:33:30Z","receivedAt":"2011-06-01T12:33:30Z","isPatch":false,"sender":{"key":"waterding@gmail.com","avatar":null},"body":"On 06/01/2011 11:41 AM, Arnaud Lacurie wrote:\n> Hi,\n>\n>> can anyone confirm that this \"--date\" option is working for git annotate\n>> cmd.\n> I tried 'git annotate --date=relative<onefile>' and it works perfectly here.\n> git version 1.7.4.1\n> ubuntu 11.04\n>\n> It works also well on the git version 1.7.5.3.401.gfb674 (The latest on master)\n>\n> Regards\n>\ntry again on my machine, give same result when with and without --date. \nhaven't tried latest master but did try the 1.7.5.3 official release \n(manual compiled)\n\n//Chengwei\n"},{"id":"169123","messageId":"20110601161638.GB7132@sigill.intra.peff.net","threadId":"27518","inReplyTo":"4DE5F655.9020400@gmail.com","subject":"Re: git annotate with date option not working?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-06-01T16:16:38Z","receivedAt":"2011-06-01T16:16:38Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jun 01, 2011 at 10:20:37AM +0200, Chengwei Ding wrote:\n\n> can anyone confirm that this \"--date\" option is working for git\n> annotate cmd.\n\nThis is by design:\n\n  $ git show 31653c1abc1ac80206db9efca56ff1969150d8fe\n  Author: Eugene Letuchy <eugene@facebook.com>\n  Date:   Fri Feb 20 14:51:11 2009 -0800\n  [...]\n      git annotate ignores the date format specifiers and continues to\n      uses the ISO format, as before.\n  [...]\n  +       if (cmd_is_annotate) {\n                  output_option |= OUTPUT_ANNOTATE_COMPAT;\n  +               blame_date_mode = DATE_ISO8601;\n  +       } else {\n  +               blame_date_mode = revs.date_mode;\n  +       }\n\nThe annotate command is a historical artifact, and will remain frozen in\ntime in terms of output format and features. If you want to use newer\nfeatures, use \"git blame\". If you really need the annotate output format\nwith newer blame features, use \"git blame -c\".\n\n-Peff\n"},{"id":"169125","messageId":"1805632198775747949@unknownmsgid","threadId":"27518","inReplyTo":"20110601161638.GB7132@sigill.intra.peff.net","subject":"Re: git annotate with date option not working?","fromName":"Chengwei Ding","fromEmail":"waterding@gmail.com","sentAt":"2011-06-01T16:28:43Z","receivedAt":"2011-06-01T16:28:43Z","isPatch":false,"sender":{"key":"waterding@gmail.com","avatar":null},"body":"Thx Peff, this really helps. So then doc on this cmd is outdated. Have\nbeen used to emacs build-in vc which call annotate (rumor say it will\nsupport git blame), anyway, have switch to other emacs git plugin now.\n\nThanks\n\n发自我的 iPhone\n\n在 Jun 1, 2011，18:16，Jeff King <peff@peff.net> 写道：\n\n> On Wed, Jun 01, 2011 at 10:20:37AM +0200, Chengwei Ding wrote:\n>\n>> can anyone confirm that this \"--date\" option is working for git\n>> annotate cmd.\n>\n> This is by design:\n>\n>  $ git show 31653c1abc1ac80206db9efca56ff1969150d8fe\n>  Author: Eugene Letuchy <eugene@facebook.com>\n>  Date:   Fri Feb 20 14:51:11 2009 -0800\n>  [...]\n>      git annotate ignores the date format specifiers and continues to\n>      uses the ISO format, as before.\n>  [...]\n>  +       if (cmd_is_annotate) {\n>                  output_option |= OUTPUT_ANNOTATE_COMPAT;\n>  +               blame_date_mode = DATE_ISO8601;\n>  +       } else {\n>  +               blame_date_mode = revs.date_mode;\n>  +       }\n>\n> The annotate command is a historical artifact, and will remain frozen in\n> time in terms of output format and features. If you want to use newer\n> features, use \"git blame\". If you really need the annotate output format\n> with newer blame features, use \"git blame -c\".\n>\n> -Peff\n"},{"id":"169127","messageId":"20110601164904.GD7132@sigill.intra.peff.net","threadId":"27518","inReplyTo":"20110601161638.GB7132@sigill.intra.peff.net","subject":"Re: git annotate with date option not working?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-06-01T16:49:04Z","receivedAt":"2011-06-01T16:49:04Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jun 01, 2011 at 12:16:38PM -0400, Jeff King wrote:\n\n> On Wed, Jun 01, 2011 at 10:20:37AM +0200, Chengwei Ding wrote:\n> \n> > can anyone confirm that this \"--date\" option is working for git\n> > annotate cmd.\n> \n> This is by design:\n> \n>   $ git show 31653c1abc1ac80206db9efca56ff1969150d8fe\n>   Author: Eugene Letuchy <eugene@facebook.com>\n>   Date:   Fri Feb 20 14:51:11 2009 -0800\n>   [...]\n>       git annotate ignores the date format specifiers and continues to\n>       uses the ISO format, as before.\n>   [...]\n>   +       if (cmd_is_annotate) {\n>                   output_option |= OUTPUT_ANNOTATE_COMPAT;\n>   +               blame_date_mode = DATE_ISO8601;\n>   +       } else {\n>   +               blame_date_mode = revs.date_mode;\n>   +       }\n> \n> The annotate command is a historical artifact, and will remain frozen in\n> time in terms of output format and features. If you want to use newer\n> features, use \"git blame\". If you really need the annotate output format\n> with newer blame features, use \"git blame -c\".\n\nHaving said that, this would be really easy to support, and I don't\nthink would have any negative compatibility consequences, as long as we\ndon't support blame.date. But I don't think we're breaking anybody\nrelying on \"git annotate --date=whatever\" being silently ignored, as\nthat option has never done anything useful.\n\nThe patch would look like this:\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 26a5d42..274a98d 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -2333,7 +2333,10 @@ int cmd_blame(int argc, const char **argv, const char *prefix)\n \n \tgit_config(git_blame_config, NULL);\n \tinit_revisions(&revs, NULL);\n-\trevs.date_mode = blame_date_mode;\n+\tif (cmd_is_annotate)\n+\t\trevs.date_mode = DATE_ISO8601;\n+\telse\n+\t\trevs.date_mode = blame_date_mode;\n \tDIFF_OPT_SET(&revs.diffopt, ALLOW_TEXTCONV);\n \n \tsave_commit_buffer = 0;\n@@ -2368,13 +2371,10 @@ parse_done:\n \tif (revs_file && read_ancestry(revs_file))\n \t\tdie_errno(\"reading graft file '%s' failed\", revs_file);\n \n-\tif (cmd_is_annotate) {\n+\tif (cmd_is_annotate)\n \t\toutput_option |= OUTPUT_ANNOTATE_COMPAT;\n-\t\tblame_date_mode = DATE_ISO8601;\n-\t} else {\n-\t\tblame_date_mode = revs.date_mode;\n-\t}\n \n+\tblame_date_mode = revs.date_mode;\n \t/* The maximum width used to show the dates */\n \tswitch (blame_date_mode) {\n \tcase DATE_RFC2822:\n"},{"id":"169144","messageId":"20110601193704.GA9950@elie","threadId":"27518","inReplyTo":"20110601164904.GD7132@sigill.intra.peff.net","subject":"Re: git annotate with date option not working?","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-06-01T19:37:04Z","receivedAt":"2011-06-01T19:37:04Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jeff King wrote:\n\n> Having said that, this would be really easy to support, and I don't\n> think would have any negative compatibility consequences, as long as we\n> don't support blame.date. But I don't think we're breaking anybody\n> relying on \"git annotate --date=whatever\" being silently ignored, as\n> that option has never done anything useful.\n>\n> The patch would look like this:\n\nLooks obviously good to me.  Chengwei (and anyone else), would you be\ninterested in moving this forward by adding tests and perhaps\ndocumentation?\n\nThanks.\n"}]}