提交 1d1876e9 编写于 作者: H Heiko Voigt 提交者: Junio C Hamano

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: NHeiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 43acdf24
...@@ -715,6 +715,13 @@ format.thread:: ...@@ -715,6 +715,13 @@ format.thread::
A true boolean value is the same as `shallow`, and a false A true boolean value is the same as `shallow`, and a false
value disables threading. value disables threading.
format.signoff::
A boolean value which lets you enable the `-s/--signoff` option of
format-patch by default. *Note:* Adding the Signed-off-by: line to a
patch should be a conscious act and means that you certify you have
the rights to submit this work under the same open source license.
Please see the 'SubmittingPatches' document for further discussion.
gc.aggressiveWindow:: gc.aggressiveWindow::
The window size parameter used in the delta compression The window size parameter used in the delta compression
algorithm used by 'git-gc --aggressive'. This defaults algorithm used by 'git-gc --aggressive'. This defaults
......
...@@ -205,6 +205,7 @@ more than one. ...@@ -205,6 +205,7 @@ more than one.
numbered = auto numbered = auto
cc = <email> cc = <email>
attach [ = mime-boundary-string ] attach [ = mime-boundary-string ]
signoff = true
------------ ------------
......
...@@ -465,6 +465,7 @@ static void add_header(const char *value) ...@@ -465,6 +465,7 @@ static void add_header(const char *value)
#define THREAD_SHALLOW 1 #define THREAD_SHALLOW 1
#define THREAD_DEEP 2 #define THREAD_DEEP 2
static int thread = 0; static int thread = 0;
static int do_signoff = 0;
static int git_format_config(const char *var, const char *value, void *cb) 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) ...@@ -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; thread = git_config_bool(var, value) && THREAD_SHALLOW;
return 0; return 0;
} }
if (!strcmp(var, "format.signoff")) {
do_signoff = git_config_bool(var, value);
return 0;
}
return git_log_config(var, value, cb); return git_log_config(var, value, cb);
} }
...@@ -865,13 +870,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) ...@@ -865,13 +870,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
} }
else if (!strcmp(argv[i], "--signoff") || else if (!strcmp(argv[i], "--signoff") ||
!strcmp(argv[i], "-s")) { !strcmp(argv[i], "-s")) {
const char *committer; do_signoff = 1;
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);
} }
else if (!strcmp(argv[i], "--attach")) { else if (!strcmp(argv[i], "--attach")) {
rev.mime_boundary = git_version_string; rev.mime_boundary = git_version_string;
...@@ -925,6 +924,16 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) ...@@ -925,6 +924,16 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
} }
argc = j; 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++) { for (i = 0; i < extra_hdr_nr; i++) {
strbuf_addstr(&buf, extra_hdr[i]); strbuf_addstr(&buf, extra_hdr[i]);
strbuf_addch(&buf, '\n'); strbuf_addch(&buf, '\n');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册