Re: [RFC/PATCH 1/4] builtin: add git-check-mailmap command
- From
Antoine Pelisse <apelisse@gmail.com>
- Date
- Jul 11, 2013, 06:45 UTC
- Message-ID
- <CALWbr2zJTBSptGsOr6tqrr4KcVd2GOWCkgy4GgdZ2+0Vz7DU4w@mail.gmail.com>
- In-Reply-To
- <1373483041-27901-2-git-send-email-sunshine@sunshineco.com>
On Wed, Jul 10, 2013 at 9:03 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 16 quoted lines
> +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 ?
Show 6 quoted lines
> + if (namelen)
> + printf("%.*s <%.*s>%c",
> + (int)namelen, name, (int)maillen, mail, term);
> + else
> + printf("<%.*s>%c", (int)maillen, mail, term);
> +}