diff options
Diffstat (limited to 'pretty.c')
-rw-r--r-- | pretty.c | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -393,6 +393,29 @@ static void add_rfc2047(struct strbuf *sb, const char *line, size_t len, strbuf_addstr(sb, "?="); } +static int is_current_user(const struct pretty_print_context *pp, + const char *email, size_t emaillen, + const char *name, size_t namelen) +{ + const char *me = git_committer_info(0); + const char *myname, *mymail; + size_t mynamelen, mymaillen; + struct ident_split ident; + + if (split_ident_line(&ident, me, strlen(me))) + return 0; /* play safe, as we do not know */ + mymail = ident.mail_begin; + mymaillen = ident.mail_end - ident.mail_begin; + myname = ident.name_begin; + mynamelen = ident.name_end - ident.name_begin; + if (pp->mailmap) + map_user(pp->mailmap, &mymail, &mymaillen, &myname, &mynamelen); + return (mymaillen == emaillen && + mynamelen == namelen && + !memcmp(mymail, email, emaillen) && + !memcmp(myname, name, namelen)); +} + void pp_user_info(const struct pretty_print_context *pp, const char *what, struct strbuf *sb, const char *line, const char *encoding) @@ -422,7 +445,6 @@ void pp_user_info(const struct pretty_print_context *pp, if (split_ident_line(&ident, line, linelen)) return; - mailbuf = ident.mail_begin; maillen = ident.mail_end - ident.mail_begin; namebuf = ident.name_begin; @@ -431,6 +453,9 @@ void pp_user_info(const struct pretty_print_context *pp, if (pp->mailmap) map_user(pp->mailmap, &mailbuf, &maillen, &namebuf, &namelen); + if (pp->inline_single && is_current_user(pp, mailbuf, maillen, namebuf, namelen)) + return; + strbuf_init(&mail, 0); strbuf_init(&name, 0); |