diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-09-14 00:55:32 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-09-14 00:55:32 -0700 |
commit | 611d8139e4e0a78797a0821074fc94a4f8d74b7b (patch) | |
tree | 992e3bebcce5faf2dc81e3dd7b6df84ade69b477 /builtin-log.c | |
parent | 568d2cde9b9fe0fc6b3202c7987b13289cb1a4a0 (diff) | |
parent | 8419d2ee9ba8b375186a5c1019df8dfbce610aba (diff) | |
download | git-611d8139e4e0a78797a0821074fc94a4f8d74b7b.tar.gz git-611d8139e4e0a78797a0821074fc94a4f8d74b7b.tar.xz |
Merge branch 'maint'
* maint:
git-format-patch --in-reply-to: accept <message@id> with angle brackets
git-add -u: do not barf on type changes
Remove duplicate note about removing commits with git-filter-branch
git-clone: improve error message if curl program is missing or not executable
hooks--update: Explicitly check for all zeros for a deleted ref.
Diffstat (limited to 'builtin-log.c')
-rw-r--r-- | builtin-log.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/builtin-log.c b/builtin-log.c index fa81c2592..c6cc3aef5 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -437,6 +437,34 @@ static void gen_message_id(char *dest, unsigned int length, char *base) (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; @@ -625,7 +653,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) 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]; |