summaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2008-02-19 07:40:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-02-20 05:49:38 (GMT)
commit7d22708b254d4ec28cd865dc5489d175ee6d65c2 (patch)
tree378316b8f3dd966c90d8889de5fd1cb5c23a323d /builtin-log.c
parenta8d8173e6c7ff85627377389e40844ec71206f5e (diff)
downloadgit-7d22708b254d4ec28cd865dc5489d175ee6d65c2.zip
git-7d22708b254d4ec28cd865dc5489d175ee6d65c2.tar.gz
git-7d22708b254d4ec28cd865dc5489d175ee6d65c2.tar.bz2
Fix format.headers not ending with a newline
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>
Diffstat (limited to 'builtin-log.c')
-rw-r--r--builtin-log.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin-log.c b/builtin-log.c
index 3dc7650..fe1a2d7 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -425,10 +425,14 @@ static int git_format_config(const char *var, const char *value)
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")) {