提交 ea718e65 编写于 作者: J Johannes Schindelin 提交者: Junio C Hamano

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: NJohannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 df63fbbf
......@@ -249,22 +249,13 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
static void show_tagger(char *buf, int len, struct rev_info *rev)
{
char *email_end, *p;
unsigned long date;
int tz;
struct strbuf out = STRBUF_INIT;
email_end = memchr(buf, '>', len);
if (!email_end)
return;
p = ++email_end;
while (isspace(*p))
p++;
date = strtoul(p, &p, 10);
while (isspace(*p))
p++;
tz = (int)strtol(p, NULL, 10);
printf("Tagger: %.*s\nDate: %s\n", (int)(email_end - buf), buf,
show_date(date, tz, rev->date_mode));
pp_user_info("Tagger", rev->commit_format, &out, buf, rev->date_mode,
git_log_output_encoding ?
git_log_output_encoding: git_commit_encoding);
printf("%s\n", out.buf);
strbuf_release(&out);
}
static int show_object(const unsigned char *sha1, int show_tag_object,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册