{"thread":{"id":"16971","subject":"[CLEANUP PATCH] show <tag>: reuse pp_user_info() instead of duplicating code","startedAt":"2009-01-02T18:08:43Z","lastAt":"2009-01-06T08:18:01Z","messageCount":2,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"99182","messageId":"alpine.DEB.1.00.0901021717350.27818@racer","threadId":"16971","inReplyTo":null,"subject":"[CLEANUP PATCH] show <tag>: reuse pp_user_info() instead of duplicating code","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-02T18:08:43Z","receivedAt":"2009-01-02T18:08:43Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWe used to extract the tagger information \"by hand\" in \"git show <tag>\",\nbut the function pp_user_info() already does that.  Even better:\nit respects the commit_format and date_format specified by the user.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tJust a little cleanup, as I tripped over that part of Git's source.\n\n builtin-log.c |   21 ++++++---------------\n 1 files changed, 6 insertions(+), 15 deletions(-)\n\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 99d1137..bc4e1e9 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -249,22 +249,13 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)\n \n static void show_tagger(char *buf, int len, struct rev_info *rev)\n {\n-\tchar *email_end, *p;\n-\tunsigned long date;\n-\tint tz;\n+\tstruct strbuf out = STRBUF_INIT;\n \n-\temail_end = memchr(buf, '>', len);\n-\tif (!email_end)\n-\t\treturn;\n-\tp = ++email_end;\n-\twhile (isspace(*p))\n-\t\tp++;\n-\tdate = strtoul(p, &p, 10);\n-\twhile (isspace(*p))\n-\t\tp++;\n-\ttz = (int)strtol(p, NULL, 10);\n-\tprintf(\"Tagger: %.*s\\nDate:   %s\\n\", (int)(email_end - buf), buf,\n-\t       show_date(date, tz, rev->date_mode));\n+\tpp_user_info(\"Tagger\", rev->commit_format, &out, buf, rev->date_mode,\n+\t\tgit_log_output_encoding ?\n+\t\tgit_log_output_encoding: git_commit_encoding);\n+\tprintf(\"%s\\n\", out.buf);\n+\tstrbuf_release(&out);\n }\n \n static int show_object(const unsigned char *sha1, int show_tag_object,\n-- \n1.6.1.rc3.224.g95ac9\n"},{"id":"99433","messageId":"7vsknwlufa.fsf@gitster.siamese.dyndns.org","threadId":"16971","inReplyTo":"alpine.DEB.1.00.0901021717350.27818@racer","subject":"Re: [CLEANUP PATCH] show <tag>: reuse pp_user_info() instead of duplicating code","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-06T08:18:01Z","receivedAt":"2009-01-06T08:18:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n"}]}