{"thread":{"id":"34016","subject":"[RFC v2] reflog: show committer date in verbose mode","startedAt":"2013-06-03T01:58:20Z","lastAt":"2013-06-03T17:43:18Z","messageCount":5,"participants":["Jiang Xin","Ramkumar Ramachandra","Duy Nguyen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"219212","messageId":"517a09251fbbc81073fbd53f04a3f4b58cb8b3f7.1370224175.git.worldhello.net@gmail.com","threadId":"34016","inReplyTo":null,"subject":"[RFC v2] reflog: show committer date in verbose mode","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2013-06-03T01:58:20Z","receivedAt":"2013-06-03T01:58:20Z","isPatch":false,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"By default, reflog won't show committer date and for some cases won't\nshow commit log either. It will be helpful to show them all by passing\na more complicated pretty formatter to `git reflog` like this:\n\n    $ git reflog show \\\n      --pretty=\"%Cred%h%Creset %gd: %gs%n  >> %Cblue%ci (%cr)%Creset: %s\"\n\nIt will be nice to add this pretty formatter automatically when run\n`git reflog` in verbose mode. And in order to support verbose mode, add\nnew flag \"verbose\" in struct rev_info.\n\nSigned-off-by: Jiang Xin <worldhello.net@gmail.com>\n---\n\nFor example:\n\n$ git reflog show -3 master\n727a4 master@{0}: merge kernel/master: Fast-forward\nedca41 master@{1}: merge kernel/master: Fast-forward\n5e49f master@{2}: merge kernel/master: Fast-forward\n\n$ git reflog show -3 -v master\n727a4 master@{0}: merge kernel/master: Fast-forward\n    Wed May 29 15:21:47 2013 -0700 (by Junio C Hamano, at 4 days ago)\nedca41 master@{1}: merge kernel/master: Fast-forward\n    Fri May 24 11:34:46 2013 -0700 (by Junio C Hamano, at 9 days ago)\n5e49f master@{2}: merge kernel/master: Fast-forward\n    Tue May 21 09:33:24 2013 -0700 (by Junio C Hamano, at 12 days ago)\n\n$ git reflog show -3 -v -v master\n\n727a4 master@{0}: merge kernel/master: Fast-forward\n    Wed May 29 15:21:47 2013 -0700 (by Junio C Hamano, at 4 days ago)\n    Sync with maint\nedca41 master@{1}: merge kernel/master: Fast-forward\n    Fri May 24 11:34:46 2013 -0700 (by Junio C Hamano, at 9 days ago)\n    Git 1.8.3\n5e49f master@{2}: merge kernel/master: Fast-forward\n    Tue May 21 09:33:24 2013 -0700 (by Junio C Hamano, at 12 days ago)\n    remote-hg: fix order of configuration comments\n\n builtin/log.c | 15 +++++++++++++++\n revision.c    |  1 +\n revision.h    |  1 +\n 3 files changed, 17 insertions(+)\n\ndiff --git a/builtin/log.c b/builtin/log.c\nindex dd3f10..d611b 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -615,6 +615,21 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)\n \trev.use_terminator = 1;\n \trev.always_show_header = 1;\n \tcmd_log_init_finish(argc, argv, prefix, &rev, &opt);\n+\tif (rev.verbose && !rev.pretty_given) {\n+\t\tstruct strbuf formatter = STRBUF_INIT;\n+\t\trev.verbose_header = 1;\n+\t\trev.pretty_given = 1;\n+\t\tstrbuf_addf(&formatter, \"%s%%h%s %%gd: %%gs%%n\",\n+\t\t\t    diff_get_color_opt(&rev.diffopt, DIFF_COMMIT),\n+\t\t\t    diff_get_color_opt(&rev.diffopt, DIFF_RESET));\n+\t\tstrbuf_addf(&formatter, \"    %s%%cd%s (by %%cn, at %%cr)\",\n+\t\t\t    diff_get_color_opt(&rev.diffopt, DIFF_METAINFO),\n+\t\t\t    diff_get_color_opt(&rev.diffopt, DIFF_RESET));\n+\t\tif (rev.verbose > 1)\n+\t\t\tstrbuf_addstr(&formatter, \"%n    %s\");\n+\t\tget_commit_format(formatter.buf, &rev);\n+\t\tstrbuf_release(&formatter);\n+\t}\n \n \treturn cmd_log_walk(&rev);\n }\ndiff --git a/revision.c b/revision.c\nindex 518cd..f7483 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1514,6 +1514,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg\n \t\trevs->combine_merges = 1;\n \t} else if (!strcmp(arg, \"-v\")) {\n \t\trevs->verbose_header = 1;\n+\t\trevs->verbose++;\n \t} else if (!strcmp(arg, \"--pretty\")) {\n \t\trevs->verbose_header = 1;\n \t\trevs->pretty_given = 1;\ndiff --git a/revision.h b/revision.h\nindex a313a..dc4d8 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -119,6 +119,7 @@ struct rev_info {\n \t\t\tshow_notes_given:1,\n \t\t\tshow_signature:1,\n \t\t\tpretty_given:1,\n+\t\t\tverbose:3,\n \t\t\tabbrev_commit:1,\n \t\t\tabbrev_commit_given:1,\n \t\t\tuse_terminator:1,\n-- \n1.8.3.490.gfd67a58.dirty\n"},{"id":"219219","messageId":"CALkWK0k-cikpwue4iQDGJgP4NrGdkCw2r=dzzP78+QbsA5BiMA@mail.gmail.com","threadId":"34016","inReplyTo":"517a09251fbbc81073fbd53f04a3f4b58cb8b3f7.1370224175.git.worldhello.net@gmail.com","subject":"Re: [RFC v2] reflog: show committer date in verbose mode","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-03T10:00:48Z","receivedAt":"2013-06-03T10:00:48Z","isPatch":false,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Jiang Xin wrote:\n> It will be nice to add this pretty formatter automatically when run\n> `git reflog` in verbose mode. And in order to support verbose mode, add\n> new flag \"verbose\" in struct rev_info.\n\nSorry I missed earlier revisions of this patch.  Generally speaking,\n\"verbose\" is a bad way to control format-specifiers.  Why not add to\nthe list of pretty-format specifiers (like oneline, short, medium,\nfull)?  Also, this patch is extremely pervasive in that it teaches a\npoorly defined \"verbosity\" to a very low layer: revision.c/revision.h.\n"},{"id":"219221","messageId":"CACsJy8AOEhETjoM9a2qFbc=md_9aELervzvRMamDE35sCpPVqw@mail.gmail.com","threadId":"34016","inReplyTo":"CALkWK0k-cikpwue4iQDGJgP4NrGdkCw2r=dzzP78+QbsA5BiMA@mail.gmail.com","subject":"Re: [RFC v2] reflog: show committer date in verbose mode","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-06-03T10:37:15Z","receivedAt":"2013-06-03T10:37:15Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Mon, Jun 3, 2013 at 5:00 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:\n> Jiang Xin wrote:\n>> It will be nice to add this pretty formatter automatically when run\n>> `git reflog` in verbose mode. And in order to support verbose mode, add\n>> new flag \"verbose\" in struct rev_info.\n>\n> Sorry I missed earlier revisions of this patch.  Generally speaking,\n> \"verbose\" is a bad way to control format-specifiers.  Why not add to\n> the list of pretty-format specifiers (like oneline, short, medium,\n> full)?\n\nI think allowing to override the default format (e.g. via config key\nreflog.format or something) and even format of -v(s) may be more\nuseful. People can define how \"reflog show\", \"reflog show -v\", \"reflog\nshow -vv\".. will display.\n--\nDuy\n"},{"id":"219222","messageId":"CANYiYbG-f+bM0jP0f-R-ciuR0sR13+8FcYkTas-X0LOh1mPRfg@mail.gmail.com","threadId":"34016","inReplyTo":"CALkWK0k-cikpwue4iQDGJgP4NrGdkCw2r=dzzP78+QbsA5BiMA@mail.gmail.com","subject":"Re: [RFC v2] reflog: show committer date in verbose mode","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2013-06-03T11:20:18Z","receivedAt":"2013-06-03T11:20:18Z","isPatch":false,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"2013/6/3 Ramkumar Ramachandra <artagnon@gmail.com>:\n> Jiang Xin wrote:\n>> It will be nice to add this pretty formatter automatically when run\n>> `git reflog` in verbose mode. And in order to support verbose mode, add\n>> new flag \"verbose\" in struct rev_info.\n>\n> Sorry I missed earlier revisions of this patch.  Generally speaking,\n> \"verbose\" is a bad way to control format-specifiers.  Why not add to\n> the list of pretty-format specifiers (like oneline, short, medium,\n> full)?  Also, this patch is extremely pervasive in that it teaches a\n> poorly defined \"verbosity\" to a very low layer: revision.c/revision.h.\n\nI also feel bad when adding new flag \"verbose\" into rev_info. = =b\n\nCommitDate is more significant than AuthorDate for reflog. In order to\nshow CommitDate, at least we provide \"fuller\" formatter, such as\n\"git reflog --pretty=fuller\". It's output is not as compact as:\n\n    $ git reflog show \\\n       --pretty=\"%Cred%h%Creset %gd: %gs%n    %Cblue%ci (%cr)%Creset%n    %s\"\n\nIntroduce new pretty-format like this is not suitable I think. Maybe\nI have to define my own alias and use it myself. ;-)\n\n\n-- \nJiang Xin\n"},{"id":"219257","messageId":"7v61xvgkeh.fsf@alter.siamese.dyndns.org","threadId":"34016","inReplyTo":"CANYiYbG-f+bM0jP0f-R-ciuR0sR13+8FcYkTas-X0LOh1mPRfg@mail.gmail.com","subject":"Re: [RFC v2] reflog: show committer date in verbose mode","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-03T17:43:18Z","receivedAt":"2013-06-03T17:43:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jiang Xin <worldhello.net@gmail.com> writes:\n\n> 2013/6/3 Ramkumar Ramachandra <artagnon@gmail.com>:\n>> Jiang Xin wrote:\n>>> It will be nice to add this pretty formatter automatically when run\n>>> `git reflog` in verbose mode. And in order to support verbose mode, add\n>>> new flag \"verbose\" in struct rev_info.\n>>\n>> Sorry I missed earlier revisions of this patch.  Generally speaking,\n>> \"verbose\" is a bad way to control format-specifiers.  Why not add to\n>> the list of pretty-format specifiers (like oneline, short, medium,\n>> full)?  Also, this patch is extremely pervasive in that it teaches a\n>> poorly defined \"verbosity\" to a very low layer: revision.c/revision.h.\n>\n> I also feel bad when adding new flag \"verbose\" into rev_info. = =b\n>\n> CommitDate is more significant than AuthorDate for reflog.\n\nThis is a curious statement, as I've seen it in a different context\nrecently.\n\nIs it committer date that you really care about, or are you using it\nas a substitute for something else you care more about, namely, the\ntime of the event the reflog entry was created (i.e. when you\ncommitted, when you resetted, when you \"branch -f\"ed)?\n"}]}