From: Antoine Pelisse Date: Thu, 11 Jul 2013 06:45:42 GMT Subject: Re: [RFC/PATCH 1/4] builtin: add git-check-mailmap command Message-ID: In-Reply-To: <1373483041-27901-2-git-send-email-sunshine@sunshineco.com> On Wed, Jul 10, 2013 at 9:03 PM, Eric Sunshine wrote: > +static void check_mailmap(struct string_list *mailmap, const char *contact) > +{ > + const char *name, *mail; > + size_t namelen, maillen; > + struct ident_split ident; > + char term = null_out ? '\0' : '\n'; > + > + if (split_ident_line(&ident, contact, strlen(contact))) > + die(_("unable to parse contact: %s"), contact); > + > + name = ident.name_begin; > + namelen = ident.name_end - ident.name_begin; > + mail = ident.mail_begin; > + maillen = ident.mail_end - ident.mail_begin; > + > + map_user(mailmap, &mail, &maillen, &name, &namelen); Would it be useful to check the return value of this function, to display a message when the name can't mapped ? > + if (namelen) > + printf("%.*s <%.*s>%c", > + (int)namelen, name, (int)maillen, mail, term); > + else > + printf("<%.*s>%c", (int)maillen, mail, term); > +}