summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a8d8173)
raw | patch | inline | side by side (parent: a8d8173)
author | Daniel Barkalow <barkalow@iabervon.org> | |
Tue, 19 Feb 2008 07:40:31 +0000 (02:40 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 20 Feb 2008 05:49:38 +0000 (21:49 -0800) |
Now each value of format.headers will always be treated as a single
valid header, and newlines will be inserted between them as needed.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
valid header, and newlines will be inserted between them as needed.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-log.c | patch | blob | history | |
t/t4014-format-patch.sh | patch | blob | history |
diff --git a/builtin-log.c b/builtin-log.c
index 3dc765011ca148d6735d83d3b2342e907eaf7bc3..fe1a2d78ebdc1c046997de02279abfd58d879cc5 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
if (!value)
die("format.headers without value");
len = strlen(value);
- extra_headers_size += len + 1;
+ while (value[len - 1] == '\n')
+ len--;
+ extra_headers_size += len + 2;
extra_headers = xrealloc(extra_headers, extra_headers_size);
- extra_headers[extra_headers_size - len - 1] = 0;
+ extra_headers[extra_headers_size - len - 2] = 0;
strcat(extra_headers, value);
+ extra_headers[extra_headers_size - 2] = '\n';
+ extra_headers[extra_headers_size - 1] = 0;
return 0;
}
if (!strcmp(var, "format.suffix")) {
index 28ab7b9a537ad99de43ef463e07894383c1ac114..755fe6dfa6818d7b64e45ec0bcb48043335a6368 100755 (executable)
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
'
-test_expect_failure 'extra headers without newlines' '
+test_expect_success 'extra headers without newlines' '
git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>" &&