summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 767c98a)
raw | patch | inline | side by side (parent: 767c98a)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 14 Sep 2007 05:30:45 +0000 (22:30 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 14 Sep 2007 07:49:12 +0000 (00:49 -0700) |
This will allow RFC-literate users to say:
format-patch --in-reply-to='<message.id@site.name>'
without forcing them to strip the surrounding angle brackets
like this:
format-patch --in-reply-to='message.id@site.name'
We accept both forms, and the latter gets necessary < and >
around it as before.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
format-patch --in-reply-to='<message.id@site.name>'
without forcing them to strip the surrounding angle brackets
like this:
format-patch --in-reply-to='message.id@site.name'
We accept both forms, and the latter gets necessary < and >
around it as before.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-log.c | patch | blob | history |
diff --git a/builtin-log.c b/builtin-log.c
index fa81c259207d24a506b671f081f7b218ceb557f4..c6cc3aef5270fe64821146376354239d54de5a26 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
(int)(email_end - email_start - 1), email_start + 1);
}
+static const char *clean_message_id(const char *msg_id)
+{
+ char ch;
+ const char *a, *z, *m;
+ char *n;
+ size_t len;
+
+ m = msg_id;
+ while ((ch = *m) && (isspace(ch) || (ch == '<')))
+ m++;
+ a = m;
+ z = NULL;
+ while ((ch = *m)) {
+ if (!isspace(ch) && (ch != '>'))
+ z = m;
+ m++;
+ }
+ if (!z)
+ die("insane in-reply-to: %s", msg_id);
+ if (++z == m)
+ return a;
+ len = z - a;
+ n = xmalloc(len + 1);
+ memcpy(n, a, len);
+ n[len] = 0;
+ return n;
+}
+
int cmd_format_patch(int argc, const char **argv, const char *prefix)
{
struct commit *commit;
if (numbered)
rev.total = total + start_number - 1;
rev.add_signoff = add_signoff;
- rev.ref_message_id = in_reply_to;
+ if (in_reply_to)
+ rev.ref_message_id = clean_message_id(in_reply_to);
while (0 <= --nr) {
int shown;
commit = list[nr];