@matheusbsbs / matheus-bagliano / commits / 1d1876e930
Fork 0

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>

Heiko Voigt committed Apr 1, 2009 at 19:51 UTC 1d1876e9300c56f399ea2976c5831674cd9818b1
3 files changed +24 -7
Documentation/config.txt
+7
@@ -715,6 +715,13 @@ format.thread::
715 A true boolean value is the same as `shallow`, and a false
716 value disables threading.
717
718 +format.signoff::
719 + A boolean value which lets you enable the `-s/--signoff` option of
720 + format-patch by default. *Note:* Adding the Signed-off-by: line to a
721 + patch should be a conscious act and means that you certify you have
722 + the rights to submit this work under the same open source license.
723 + Please see the 'SubmittingPatches' document for further discussion.
724 +
725 gc.aggressiveWindow::
726 The window size parameter used in the delta compression
727 algorithm used by 'git-gc --aggressive'. This defaults
Documentation/git-format-patch.txt
+1
@@ -205,6 +205,7 @@ more than one.
205 numbered = auto
206 cc = <email>
207 attach [ = mime-boundary-string ]
208 + signoff = true
209 ------------
210
211
builtin-log.c
+16 -7
@@ -465,6 +465,7 @@ static void add_header(const char *value)
465 #define THREAD_SHALLOW 1
466 #define THREAD_DEEP 2
467 static int thread = 0;
468 +static int do_signoff = 0;
469
470 static int git_format_config(const char *var, const char *value, void *cb)
471 {
@@ -514,6 +515,10 @@ static int git_format_config(const char *var, const char *value, void *cb)
515 thread = git_config_bool(var, value) && THREAD_SHALLOW;
516 return 0;
517 }
518 + if (!strcmp(var, "format.signoff")) {
519 + do_signoff = git_config_bool(var, value);
520 + return 0;
521 + }
522
523 return git_log_config(var, value, cb);
524 }
@@ -865,13 +870,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
870 }
871 else if (!strcmp(argv[i], "--signoff") ||
872 !strcmp(argv[i], "-s")) {
868 - const char *committer;
869 - const char *endpos;
870 - committer = git_committer_info(IDENT_ERROR_ON_NO_NAME);
871 - endpos = strchr(committer, '>');
872 - if (!endpos)
873 - die("bogus committer info %s", committer);
874 - add_signoff = xmemdupz(committer, endpos - committer + 1);
873 + do_signoff = 1;
874 }
875 else if (!strcmp(argv[i], "--attach")) {
876 rev.mime_boundary = git_version_string;
@@ -925,6 +924,16 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
924 }
925 argc = j;
926
927 + if (do_signoff) {
928 + const char *committer;
929 + const char *endpos;
930 + committer = git_committer_info(IDENT_ERROR_ON_NO_NAME);
931 + endpos = strchr(committer, '>');
932 + if (!endpos)
933 + die("bogus committer info %s", committer);
934 + add_signoff = xmemdupz(committer, endpos - committer + 1);
935 + }
936 +
937 for (i = 0; i < extra_hdr_nr; i++) {
938 strbuf_addstr(&buf, extra_hdr[i]);
939 strbuf_addch(&buf, '\n');