diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2006-06-02 15:21:17 +0200 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-06-02 07:30:55 -0700 |
commit | 20ff06805c66826404b154b9309a8581449af2b0 (patch) | |
tree | 513c96694e7e782b2391a830ca2ff9d60b6ef436 /builtin-log.c | |
parent | cf2251b60460e651a5e00afe9ef7c427ad296711 (diff) | |
download | git-20ff06805c66826404b154b9309a8581449af2b0.tar.gz git-20ff06805c66826404b154b9309a8581449af2b0.tar.xz |
format-patch: resurrect extra headers from config
Once again, if you have
[format]
headers = "Origamization: EvilEmpire\n"
format-patch will add these headers just after the "Subject:" line.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-log.c')
-rw-r--r-- | builtin-log.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/builtin-log.c b/builtin-log.c index ac4822dea..6612f4c2a 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -85,6 +85,23 @@ static int istitlechar(char c) (c >= '0' && c <= '9') || c == '.' || c == '_'; } +static char *extra_headers = NULL; +static int extra_headers_size = 0; + +static int git_format_config(const char *var, const char *value) +{ + if (!strcmp(var, "format.headers")) { + int len = strlen(value); + extra_headers_size += len + 1; + extra_headers = realloc(extra_headers, extra_headers_size); + extra_headers[extra_headers_size - len - 1] = 0; + strcat(extra_headers, value); + return 0; + } + return git_default_config(var, value); +} + + static FILE *realstdout = NULL; static char *output_directory = NULL; @@ -162,6 +179,9 @@ int cmd_format_patch(int argc, const char **argv, char **envp) rev.ignore_merges = 1; rev.diffopt.output_format = DIFF_FORMAT_PATCH; + git_config(git_format_config); + rev.extra_headers = extra_headers; + /* * Parse the arguments before setup_revisions(), or something * like "git fmt-patch -o a123 HEAD^.." may fail; a123 is |