@matheusbsbs / matheus-bagliano / commits / ea718e65fa
Fork 0

show <tag>: reuse pp_user_info() instead of duplicating code

We used to extract the tagger information "by hand" in "git show <tag>", but the function pp_user_info() already does that. Even better: it respects the commit_format and date_format specified by the user. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jan 2, 2009 at 19:08 UTC ea718e65fab17297a8a9dbebf63ae99096e9537a
1 file changed +6 -15
builtin-log.c
+6 -15
@@ -249,22 +249,13 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
249
250 static void show_tagger(char *buf, int len, struct rev_info *rev)
251 {
252 - char *email_end, *p;
253 - unsigned long date;
254 - int tz;
252 + struct strbuf out = STRBUF_INIT;
253
256 - email_end = memchr(buf, '>', len);
257 - if (!email_end)
258 - return;
259 - p = ++email_end;
260 - while (isspace(*p))
261 - p++;
262 - date = strtoul(p, &p, 10);
263 - while (isspace(*p))
264 - p++;
265 - tz = (int)strtol(p, NULL, 10);
266 - printf("Tagger: %.*s\nDate: %s\n", (int)(email_end - buf), buf,
267 - show_date(date, tz, rev->date_mode));
254 + pp_user_info("Tagger", rev->commit_format, &out, buf, rev->date_mode,
255 + git_log_output_encoding ?
256 + git_log_output_encoding: git_commit_encoding);
257 + printf("%s\n", out.buf);
258 + strbuf_release(&out);
259 }
260
261 static int show_object(const unsigned char *sha1, int show_tag_object,