Skip to content

Commit

Permalink
format-patch: use default email for generating message ids
Browse files Browse the repository at this point in the history
We try to generate a sane message id for cover letters and
threading by appending some changing bits to the front of
the user's email address. The current code parses the email
out of the results of git_committer_info, but we can do this
much more easily by just calling ident_default_email
ourselves.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed May 22, 2012
1 parent 132f4b6 commit 43ae9f4
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions builtin/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,15 +737,9 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha

static void gen_message_id(struct rev_info *info, char *base)
{
const char *committer = git_committer_info(IDENT_WARN_ON_NO_NAME);
const char *email_start = strrchr(committer, '<');
const char *email_end = strrchr(committer, '>');
struct strbuf buf = STRBUF_INIT;
if (!email_start || !email_end || email_start > email_end - 1)
die(_("Could not extract email from committer identity."));
strbuf_addf(&buf, "%s.%lu.git.%.*s", base,
(unsigned long) time(NULL),
(int)(email_end - email_start - 1), email_start + 1);
strbuf_addf(&buf, "%s.%lu.git.%s", base,
(unsigned long) time(NULL), ident_default_email());
info->message_id = strbuf_detach(&buf, NULL);
}

Expand Down

0 comments on commit 43ae9f4

Please sign in to comment.