diff options
author | Heiko Voigt <hvoigt@hvoigt.net> | 2009-04-01 19:51:54 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-04-06 00:12:32 -0700 |
commit | 1d1876e9300c56f399ea2976c5831674cd9818b1 (patch) | |
tree | 377255783c74fcbf230d513c3240e0e8fbb13bd1 /builtin-log.c | |
parent | 43acdf243ee8a8fa876bdd6659026fe5ed2d4c24 (diff) | |
download | git-1d1876e9300c56f399ea2976c5831674cd9818b1.tar.gz |
Add configuration variable for sign-off to format-patch
If you regularly create patches which require a Signed-off: line you may
want to make it your default to add that line. It also helps you not to forget
to add the -s/--signoff switch.
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-log.c')
-rw-r--r-- | builtin-log.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/builtin-log.c b/builtin-log.c index 27bc0dce23..eb2c0541b5 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -465,6 +465,7 @@ static void add_header(const char *value) #define THREAD_SHALLOW 1 #define THREAD_DEEP 2 static int thread = 0; +static int do_signoff = 0; static int git_format_config(const char *var, const char *value, void *cb) { @@ -514,6 +515,10 @@ static int git_format_config(const char *var, const char *value, void *cb) thread = git_config_bool(var, value) && THREAD_SHALLOW; return 0; } + if (!strcmp(var, "format.signoff")) { + do_signoff = git_config_bool(var, value); + return 0; + } return git_log_config(var, value, cb); } @@ -865,13 +870,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) } else if (!strcmp(argv[i], "--signoff") || !strcmp(argv[i], "-s")) { - const char *committer; - const char *endpos; - committer = git_committer_info(IDENT_ERROR_ON_NO_NAME); - endpos = strchr(committer, '>'); - if (!endpos) - die("bogus committer info %s", committer); - add_signoff = xmemdupz(committer, endpos - committer + 1); + do_signoff = 1; } else if (!strcmp(argv[i], "--attach")) { rev.mime_boundary = git_version_string; @@ -925,6 +924,16 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) } argc = j; + if (do_signoff) { + const char *committer; + const char *endpos; + committer = git_committer_info(IDENT_ERROR_ON_NO_NAME); + endpos = strchr(committer, '>'); + if (!endpos) + die("bogus committer info %s", committer); + add_signoff = xmemdupz(committer, endpos - committer + 1); + } + for (i = 0; i < extra_hdr_nr; i++) { strbuf_addstr(&buf, extra_hdr[i]); strbuf_addch(&buf, '\n'); |