X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=builtin-log.c;h=6612f4c2a803451a6769d26345089e36b4bc221e;hb=2b11e3170e919866c7f5554dd4089289a1bb6726;hp=ac4822deaf2549a0a972557c8e35ea5513a901d7;hpb=cf2251b60460e651a5e00afe9ef7c427ad296711;p=git.git diff --git a/builtin-log.c b/builtin-log.c index ac4822de..6612f4c2 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