{"thread":{"id":"24116","subject":"[PATCH 1/2] format-patch: Add a signature option (--signature)","startedAt":"2010-06-15T05:00:38Z","lastAt":"2010-06-16T20:55:49Z","messageCount":10,"participants":["Stephen Boyd","Junio C Hamano","Theodore Tso"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"143718","messageId":"1276578039-25023-1-git-send-email-bebarino@gmail.com","threadId":"24116","inReplyTo":null,"subject":"[PATCH 1/2] format-patch: Add a signature option (--signature)","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-06-15T05:00:38Z","receivedAt":"2010-06-15T05:00:38Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"By default, git uses the version string as the signature for all\npatches output by format-patch. Many employers (mine included)\nrequire the use of a signature on all outgoing mails. In a\nformat-patch | send-email workflow there isn't an easy way to modify\nthe signature without breaking the pipe and manually replacing the\nversion string with the signature required. Instead of doing all that\nwork, add an option (--signature) and a config variable\n(format.signature) to replace the default git version signature when\nformatting patches.\n\nThis does modify the original behavior of format-patch a bit. First\noff the version string is now placed in the cover letter by default.\nSecondly, once the configuration variable format.signature is added\nto the .config file there is no way to revert back to the default\ngit version signature. Instead, specifying the --no-signature option\nwill remove the signature from the patches entirely.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n\nI didn't cover the attachment case since there wasn't a signature there\nbefore. Maybe later.\n\n Documentation/config.txt                           |    5 +++\n Documentation/git-format-patch.txt                 |    8 ++++-\n builtin/log.c                                      |   18 ++++++++--\n ...tch_--stdout_--cover-letter_-n_initial..master^ |    3 ++\n t/t4014-format-patch.sh                            |   35 ++++++++++++++++++++\n 5 files changed, 65 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 95cf73c..28379cc 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -880,6 +880,11 @@ format.subjectprefix::\n \tThe default for format-patch is to output files with the '[PATCH]'\n \tsubject prefix. Use this variable to change that prefix.\n \n+format.signature::\n+\tThe default for format-patch is to output a signature containing\n+\tthe git version number. Use this variable to change the default\n+\tsignature.\n+\n format.suffix::\n \tThe default for format-patch is to output files with the suffix\n \t`.patch`. Use this variable to change that suffix (make sure to\ndiff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\nindex 835fb71..9a1b1d0 100644\n--- a/Documentation/git-format-patch.txt\n+++ b/Documentation/git-format-patch.txt\n@@ -12,7 +12,7 @@ SYNOPSIS\n 'git format-patch' [-k] [(-o|--output-directory) <dir> | --stdout]\n \t\t   [--no-thread | --thread[=<style>]]\n \t\t   [(--attach|--inline)[=<boundary>] | --no-attach]\n-\t\t   [-s | --signoff]\n+\t\t   [-s | --signoff] [--signature=<signature>]\n \t\t   [-n | --numbered | -N | --no-numbered]\n \t\t   [--start-number <n>] [--numbered-files]\n \t\t   [--in-reply-to=Message-Id] [--suffix=.<sfx>]\n@@ -180,6 +180,12 @@ will want to ensure that threading is disabled for `git send-email`.\n \tcontaining the shortlog and the overall diffstat.  You can\n \tfill in a description in the file before sending it out.\n \n+--signature=<signature>::\n+\tAdd a signature to each patch and, if --cover-letter is specified,\n+\tthe cover letter. Per RFC 3676 the signature is separated from the\n+\tbody by '-- '. If no signature option is given, the signature defaults\n+\tto the git version number.\n+\n --suffix=.<sfx>::\n \tInstead of using `.patch` as the suffix for generated\n \tfilenames, use specified suffix.  A common alternative is\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 976e16f..b78027e 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -549,8 +549,9 @@ static void add_header(const char *value)\n \n #define THREAD_SHALLOW 1\n #define THREAD_DEEP 2\n-static int thread = 0;\n-static int do_signoff = 0;\n+static int thread;\n+static int do_signoff;\n+static const char *signature = git_version_string;\n \n static int git_format_config(const char *var, const char *value, void *cb)\n {\n@@ -609,6 +610,8 @@ static int git_format_config(const char *var, const char *value, void *cb)\n \t\tdo_signoff = git_config_bool(var, value);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(var, \"format.signature\"))\n+\t\treturn git_config_string(&signature, var, value);\n \n \treturn git_log_config(var, value, cb);\n }\n@@ -703,6 +706,12 @@ static void gen_message_id(struct rev_info *info, char *base)\n \tinfo->message_id = strbuf_detach(&buf, NULL);\n }\n \n+static void print_signature(void)\n+{\n+\tif (signature)\n+\t\tprintf(\"-- \\n%s\\n\\n\", signature);\n+}\n+\n static void make_cover_letter(struct rev_info *rev, int use_stdout,\n \t\t\t      int numbered, int numbered_files,\n \t\t\t      struct commit *origin,\n@@ -796,6 +805,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,\n \tdiff_flush(&opts);\n \n \tprintf(\"\\n\");\n+\tprint_signature();\n }\n \n static const char *clean_message_id(const char *msg_id)\n@@ -1035,6 +1045,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t{ OPTION_CALLBACK, 0, \"thread\", &thread, \"style\",\n \t\t\t    \"enable message threading, styles: shallow, deep\",\n \t\t\t    PARSE_OPT_OPTARG, thread_callback },\n+\t\tOPT_STRING(0, \"signature\", &signature, \"signature\",\n+\t\t\t    \"add a signature\"),\n \t\tOPT_END()\n \t};\n \n@@ -1313,7 +1325,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t\t\t       mime_boundary_leader,\n \t\t\t\t       rev.mime_boundary);\n \t\t\telse\n-\t\t\t\tprintf(\"-- \\n%s\\n\\n\", git_version_string);\n+\t\t\t\tprint_signature();\n \t\t}\n \t\tif (!use_stdout)\n \t\t\tfclose(stdout);\ndiff --git a/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^ b/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^\nindex 8dab4bf..1f0f9ad 100644\n--- a/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^\n+++ b/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^\n@@ -18,6 +18,9 @@ A U Thor (2):\n  create mode 100644 file1\n  delete mode 100644 file2\n \n+-- \n+g-i-t--v-e-r-s-i-o-n\n+\n From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001\n From: A U Thor <author@example.com>\n Date: Mon, 26 Jun 2006 00:01:00 +0000\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex d21c37f..06c481f 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -613,4 +613,39 @@ test_expect_success 'format-patch --ignore-if-in-upstream HEAD' '\n \tgit format-patch --ignore-if-in-upstream HEAD\n '\n \n+test_expect_success 'format-patch --signature' '\n+\tgit format-patch --stdout --signature=\"my sig\" -1 >output &&\n+\tgrep \"my sig\" output\n+'\n+\n+test_expect_success 'format-patch with format.signature config' '\n+\tgit config format.signature \"config sig\" &&\n+\tgit format-patch --stdout -1 >output &&\n+\tgrep \"config sig\" output\n+'\n+\n+test_expect_success 'format-patch --signature overrides format.signature' '\n+\tgit config format.signature \"config sig\" &&\n+\tgit format-patch --stdout --signature=\"overrides\" -1 >output &&\n+\t! grep \"config sig\" output &&\n+\tgrep \"overrides\" output\n+'\n+\n+test_expect_success 'format-patch --no-signature ignores format.signature' '\n+\tgit config format.signature \"config sig\" &&\n+\tgit format-patch --stdout --signature=\"my sig\" --no-signature \\\n+\t\t-1 >output &&\n+\t! grep \"config sig\" output &&\n+\t! grep \"my sig\" output &&\n+\t! grep \"^-- \\$\" output\n+'\n+\n+test_expect_success 'format-patch --signature --cover-letter' '\n+\tgit config --unset-all format.signature &&\n+\tgit format-patch --stdout --signature=\"my sig\" --cover-letter \\\n+\t\t-1 >output &&\n+\tgrep \"my sig\" output &&\n+\ttest 2 = $(grep \"my sig\" output | wc -l)\n+'\n+\n test_done\n-- \n1.7.1.257.g678728\n"},{"id":"143719","messageId":"1276578039-25023-2-git-send-email-bebarino@gmail.com","threadId":"24116","inReplyTo":"1276578039-25023-1-git-send-email-bebarino@gmail.com","subject":"[PATCH 2/2] completion: Add --signoff and format.signoff","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-06-15T05:00:39Z","receivedAt":"2010-06-15T05:00:39Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Cc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n\nFeel free to squash.\n\n contrib/completion/git-completion.bash |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 57245a8..9ca54e0 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1052,7 +1052,7 @@ _git_format_patch ()\n \t\t\t--numbered --start-number\n \t\t\t--numbered-files\n \t\t\t--keep-subject\n-\t\t\t--signoff\n+\t\t\t--signoff --signature\n \t\t\t--in-reply-to= --cc=\n \t\t\t--full-index --binary\n \t\t\t--not --all\n@@ -1726,6 +1726,7 @@ _git_config ()\n \t\tformat.headers\n \t\tformat.numbered\n \t\tformat.pretty\n+\t\tformat.signature\n \t\tformat.signoff\n \t\tformat.subjectprefix\n \t\tformat.suffix\n-- \n1.7.1.257.g678728\n"},{"id":"143769","messageId":"7viq5k6xbj.fsf@alter.siamese.dyndns.org","threadId":"24116","inReplyTo":"1276578039-25023-1-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH 1/2] format-patch: Add a signature option (--signature)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-06-15T17:05:20Z","receivedAt":"2010-06-15T17:05:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Boyd <bebarino@gmail.com> writes:\n\n> This does modify the original behavior of format-patch a bit. First\n> off the version string is now placed in the cover letter by default.\n\nThat part is fine; I think it was an oversight of the cover letter\naddition.\n\n> Secondly, once the configuration variable format.signature is added\n> to the .config file there is no way to revert back to the default\n> git version signature. Instead, specifying the --no-signature option\n> will remove the signature from the patches entirely.\n\nHmph.  That is somewhat sad, but it probably is Ok.\n\n> @@ -180,6 +180,12 @@ will want to ensure that threading is disabled for `git send-email`.\n>  \tcontaining the shortlog and the overall diffstat.  You can\n>  \tfill in a description in the file before sending it out.\n>  \n> +--signature=<signature>::\n> +\tAdd a signature to each patch and, if --cover-letter is specified,\n> +\tthe cover letter. Per RFC 3676 the signature is separated from the\n> +\tbody by '-- '.\n\nWouldn't \"Add a signature to each message produced\" be easier to understand?\nAlso perhaps s/body by '-- '/& a line with '-- ' on it/?\n\nDon't we want either an extra header to this entry (\"--no-signature::\")\nand advertise it as a way to disable signature generation?\n\n> diff --git a/builtin/log.c b/builtin/log.c\n> index 976e16f..b78027e 100644\n> --- a/builtin/log.c\n> +++ b/builtin/log.c\n> @@ -609,6 +610,8 @@ static int git_format_config(const char *var, const char *value, void *cb)\n>  \t\tdo_signoff = git_config_bool(var, value);\n>  \t\treturn 0;\n>  \t}\n> +\tif (!strcmp(var, \"format.signature\"))\n> +\t\treturn git_config_string(&signature, var, value);\n>  \n>  \treturn git_log_config(var, value, cb);\n>  }\n\nThis, together with ...\n\n> @@ -703,6 +706,12 @@ static void gen_message_id(struct rev_info *info, char *base)\n>  \tinfo->message_id = strbuf_detach(&buf, NULL);\n>  }\n>  \n> +static void print_signature(void)\n> +{\n> +\tif (signature)\n> +\t\tprintf(\"-- \\n%s\\n\\n\", signature);\n> +}\n> +\n\n... this, and ...\n\n> @@ -1035,6 +1045,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n>  \t\t{ OPTION_CALLBACK, 0, \"thread\", &thread, \"style\",\n>  \t\t\t    \"enable message threading, styles: shallow, deep\",\n>  \t\t\t    PARSE_OPT_OPTARG, thread_callback },\n> +\t\tOPT_STRING(0, \"signature\", &signature, \"signature\",\n> +\t\t\t    \"add a signature\"),\n>  \t\tOPT_END()\n>  \t};\n\n... this would mean that\n\n (1) these behave differently:\n\n\tformat-patch --no-signature -1 HEAD\n        format-patch --signature= -1 HEAD\n\n (2) this behaves like the second one in the above:\n\n\t[format]\n        \tsignature = \"\"\n\n (3) there is no way to say \"no signature, ever\" in the configuration.\n\nPerhaps we would want to do this instead?\n\n        static void print_signature(void)\n        {\n                if (signature && *signature)\n                        printf(\"-- \\n%s\\n\\n\", signature);\n        }\n"},{"id":"143805","messageId":"4C1853AE.4010104@gmail.com","threadId":"24116","inReplyTo":"7viq5k6xbj.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/2] format-patch: Add a signature option (--signature)","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-06-16T04:31:42Z","receivedAt":"2010-06-16T04:31:42Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"On 06/15/2010 10:05 AM, Junio C Hamano wrote:\n> Stephen Boyd <bebarino@gmail.com> write\n>> @@ -180,6 +180,12 @@ will want to ensure that threading is disabled for `git send-email`.\n>>  \tcontaining the shortlog and the overall diffstat.  You can\n>>  \tfill in a description in the file before sending it out.\n>>  \n>> +--signature=<signature>::\n>> +\tAdd a signature to each patch and, if --cover-letter is specified,\n>> +\tthe cover letter. Per RFC 3676 the signature is separated from the\n>> +\tbody by '-- '.\n>\n> Wouldn't \"Add a signature to each message produced\" be easier to understand?\n> Also perhaps s/body by '-- '/& a line with '-- ' on it/?\n>\n> Don't we want either an extra header to this entry (\"--no-signature::\")\n> and advertise it as a way to disable signature generation?\n\nBoth sound good.\n\n>\n>  (3) there is no way to say \"no signature, ever\" in the configuration.\n>\n> Perhaps we would want to do this instead?\n>\n>         static void print_signature(void)\n>         {\n>                 if (signature && *signature)\n>                         printf(\"-- \\n%s\\n\\n\", signature);\n>         }\n\nSounds good too. It's not entirely obvious that format.signature=\"\"\nmeans no signature ever, but that's where documentation steps in I guess.\n"},{"id":"143808","messageId":"1276667966-18422-1-git-send-email-bebarino@gmail.com","threadId":"24116","inReplyTo":"1276578039-25023-1-git-send-email-bebarino@gmail.com","subject":"[PATCHv2 1/2] format-patch: Add a signature option (--signature)","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-06-16T05:59:25Z","receivedAt":"2010-06-16T05:59:25Z","isPatch":false,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"By default, git uses the version string as the signature for all\npatches output by format-patch. Many employers (mine included)\nrequire the use of a signature on all outgoing mails. In a\nformat-patch | send-email workflow there isn't an easy way to modify\nthe signature without breaking the pipe and manually replacing the\nversion string with the signature required. Instead of doing all that\nwork, add an option (--signature) and a config variable\n(format.signature) to replace the default git version signature when\nformatting patches.\n\nThis does modify the original behavior of format-patch a bit. First\noff the version string is now placed in the cover letter by default.\nSecondly, once the configuration variable format.signature is added\nto the .config file there is no way to revert back to the default\ngit version signature. Instead, specifying the --no-signature option\nwill remove the signature from the patches entirely.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n\n Changes since v1:\n  - Logic to cover empty string case\n  - Documentation updates\n  - Tests for empty string behavior\n\n Documentation/config.txt                           |    6 ++\n Documentation/git-format-patch.txt                 |    7 +++\n builtin/log.c                                      |   18 ++++++-\n ...tch_--stdout_--cover-letter_-n_initial..master^ |    3 +\n t/t4014-format-patch.sh                            |   52 ++++++++++++++++++++\n 5 files changed, 83 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 95cf73c..be6e85d 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -880,6 +880,12 @@ format.subjectprefix::\n \tThe default for format-patch is to output files with the '[PATCH]'\n \tsubject prefix. Use this variable to change that prefix.\n \n+format.signature::\n+\tThe default for format-patch is to output a signature containing\n+\tthe git version number. Use this variable to change that default.\n+\tSet this variable to the empty string (\"\") to suppress\n+\tsignature generation.\n+\n format.suffix::\n \tThe default for format-patch is to output files with the suffix\n \t`.patch`. Use this variable to change that suffix (make sure to\ndiff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\nindex 835fb71..c8c81e8 100644\n--- a/Documentation/git-format-patch.txt\n+++ b/Documentation/git-format-patch.txt\n@@ -13,6 +13,7 @@ SYNOPSIS\n \t\t   [--no-thread | --thread[=<style>]]\n \t\t   [(--attach|--inline)[=<boundary>] | --no-attach]\n \t\t   [-s | --signoff]\n+\t\t   [--signature=<signature> | --no-signature]\n \t\t   [-n | --numbered | -N | --no-numbered]\n \t\t   [--start-number <n>] [--numbered-files]\n \t\t   [--in-reply-to=Message-Id] [--suffix=.<sfx>]\n@@ -180,6 +181,12 @@ will want to ensure that threading is disabled for `git send-email`.\n \tcontaining the shortlog and the overall diffstat.  You can\n \tfill in a description in the file before sending it out.\n \n+--[no]-signature=<signature>::\n+\tAdd a signature to each message produced. Per RFC 3676 the signature\n+\tis separated from the body by a line with '-- ' on it. If the\n+\tsignature option is omitted the signature defaults to the git version\n+\tnumber.\n+\n --suffix=.<sfx>::\n \tInstead of using `.patch` as the suffix for generated\n \tfilenames, use specified suffix.  A common alternative is\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 976e16f..f068583 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -549,8 +549,9 @@ static void add_header(const char *value)\n \n #define THREAD_SHALLOW 1\n #define THREAD_DEEP 2\n-static int thread = 0;\n-static int do_signoff = 0;\n+static int thread;\n+static int do_signoff;\n+static const char *signature = git_version_string;\n \n static int git_format_config(const char *var, const char *value, void *cb)\n {\n@@ -609,6 +610,8 @@ static int git_format_config(const char *var, const char *value, void *cb)\n \t\tdo_signoff = git_config_bool(var, value);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(var, \"format.signature\"))\n+\t\treturn git_config_string(&signature, var, value);\n \n \treturn git_log_config(var, value, cb);\n }\n@@ -703,6 +706,12 @@ static void gen_message_id(struct rev_info *info, char *base)\n \tinfo->message_id = strbuf_detach(&buf, NULL);\n }\n \n+static void print_signature(void)\n+{\n+\tif (signature && *signature)\n+\t\tprintf(\"-- \\n%s\\n\\n\", signature);\n+}\n+\n static void make_cover_letter(struct rev_info *rev, int use_stdout,\n \t\t\t      int numbered, int numbered_files,\n \t\t\t      struct commit *origin,\n@@ -796,6 +805,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,\n \tdiff_flush(&opts);\n \n \tprintf(\"\\n\");\n+\tprint_signature();\n }\n \n static const char *clean_message_id(const char *msg_id)\n@@ -1035,6 +1045,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t{ OPTION_CALLBACK, 0, \"thread\", &thread, \"style\",\n \t\t\t    \"enable message threading, styles: shallow, deep\",\n \t\t\t    PARSE_OPT_OPTARG, thread_callback },\n+\t\tOPT_STRING(0, \"signature\", &signature, \"signature\",\n+\t\t\t    \"add a signature\"),\n \t\tOPT_END()\n \t};\n \n@@ -1313,7 +1325,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t\t\t       mime_boundary_leader,\n \t\t\t\t       rev.mime_boundary);\n \t\t\telse\n-\t\t\t\tprintf(\"-- \\n%s\\n\\n\", git_version_string);\n+\t\t\t\tprint_signature();\n \t\t}\n \t\tif (!use_stdout)\n \t\t\tfclose(stdout);\ndiff --git a/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^ b/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^\nindex 8dab4bf..1f0f9ad 100644\n--- a/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^\n+++ b/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^\n@@ -18,6 +18,9 @@ A U Thor (2):\n  create mode 100644 file1\n  delete mode 100644 file2\n \n+-- \n+g-i-t--v-e-r-s-i-o-n\n+\n From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001\n From: A U Thor <author@example.com>\n Date: Mon, 26 Jun 2006 00:01:00 +0000\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex d21c37f..f87434b 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -613,4 +613,56 @@ test_expect_success 'format-patch --ignore-if-in-upstream HEAD' '\n \tgit format-patch --ignore-if-in-upstream HEAD\n '\n \n+test_expect_success 'format-patch --signature' '\n+\tgit format-patch --stdout --signature=\"my sig\" -1 >output &&\n+\tgrep \"my sig\" output\n+'\n+\n+test_expect_success 'format-patch with format.signature config' '\n+\tgit config format.signature \"config sig\" &&\n+\tgit format-patch --stdout -1 >output &&\n+\tgrep \"config sig\" output\n+'\n+\n+test_expect_success 'format-patch --signature overrides format.signature' '\n+\tgit config format.signature \"config sig\" &&\n+\tgit format-patch --stdout --signature=\"overrides\" -1 >output &&\n+\t! grep \"config sig\" output &&\n+\tgrep \"overrides\" output\n+'\n+\n+test_expect_success 'format-patch --no-signature ignores format.signature' '\n+\tgit config format.signature \"config sig\" &&\n+\tgit format-patch --stdout --signature=\"my sig\" --no-signature \\\n+\t\t-1 >output &&\n+\t! grep \"config sig\" output &&\n+\t! grep \"my sig\" output &&\n+\t! grep \"^-- \\$\" output\n+'\n+\n+test_expect_success 'format-patch --signature --cover-letter' '\n+\tgit config --unset-all format.signature &&\n+\tgit format-patch --stdout --signature=\"my sig\" --cover-letter \\\n+\t\t-1 >output &&\n+\tgrep \"my sig\" output &&\n+\ttest 2 = $(grep \"my sig\" output | wc -l)\n+'\n+\n+test_expect_success 'format.signature=\"\" supresses signatures' '\n+\tgit config format.signature \"\" &&\n+\tgit format-patch --stdout -1 >output &&\n+\t! grep \"^-- \\$\" output\n+'\n+\n+test_expect_success 'format-patch --no-signature supresses signatures' '\n+\tgit config --unset-all format.signature &&\n+\tgit format-patch --stdout --no-signature -1 >output &&\n+\t! grep \"^-- \\$\" output\n+'\n+\n+test_expect_success 'format-patch --signature=\"\" supresses signatures' '\n+\tgit format-patch --signature=\"\" -1 >output &&\n+\t! grep \"^-- \\$\" output\n+'\n+\n test_done\n-- \n1.7.1.257.g678728\n"},{"id":"143809","messageId":"1276667966-18422-2-git-send-email-bebarino@gmail.com","threadId":"24116","inReplyTo":"1276578039-25023-1-git-send-email-bebarino@gmail.com","subject":"[PATCHv2 2/2] completion: Add --signature and format.signature","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-06-16T05:59:26Z","receivedAt":"2010-06-16T05:59:26Z","isPatch":false,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Cc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n\n Changes since v1:\n  - Fixed subject (hah --signoff was totally wrong)\n\n contrib/completion/git-completion.bash |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 57245a8..d950776 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1052,7 +1052,7 @@ _git_format_patch ()\n \t\t\t--numbered --start-number\n \t\t\t--numbered-files\n \t\t\t--keep-subject\n-\t\t\t--signoff\n+\t\t\t--signoff --signature --no-signature\n \t\t\t--in-reply-to= --cc=\n \t\t\t--full-index --binary\n \t\t\t--not --all\n@@ -1726,6 +1726,7 @@ _git_config ()\n \t\tformat.headers\n \t\tformat.numbered\n \t\tformat.pretty\n+\t\tformat.signature\n \t\tformat.signoff\n \t\tformat.subjectprefix\n \t\tformat.suffix\n-- \n1.7.1.257.g678728\n"},{"id":"143819","messageId":"DB1710D5-1699-45C2-8884-5D60C5240ED9@mit.edu","threadId":"24116","inReplyTo":"1276578039-25023-1-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH 1/2] format-patch: Add a signature option (--signature)","fromName":"Theodore Tso","fromEmail":"tytso@mit.edu","sentAt":"2010-06-16T13:13:09Z","receivedAt":"2010-06-16T13:13:09Z","isPatch":true,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"\nOn Jun 15, 2010, at 1:00 AM, Stephen Boyd wrote:\n\n> \n> This does modify the original behavior of format-patch a bit. First\n> off the version string is now placed in the cover letter by default.\n\nI don't know how important people will feel this to be, but I've occasionally\nfound it interesting to see how many people are using various different\nversions of git in a particular development community, and having the\nversion in the signature is a useful gauge on that.  Putting it in the cover\nletter isn't really a complete substitute for this because many patches\nand short patch series go out without cover letters...\n\n-- Ted\n"},{"id":"143824","messageId":"7vwrtygbq5.fsf@alter.siamese.dyndns.org","threadId":"24116","inReplyTo":"DB1710D5-1699-45C2-8884-5D60C5240ED9@mit.edu","subject":"Re: [PATCH 1/2] format-patch: Add a signature option (--signature)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-06-16T16:53:54Z","receivedAt":"2010-06-16T16:53:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Theodore Tso <tytso@MIT.EDU> writes:\n\n> On Jun 15, 2010, at 1:00 AM, Stephen Boyd wrote:\n>> \n>> This does modify the original behavior of format-patch a bit. First\n>> off the version string is now placed in the cover letter by default.\n>\n> I don't know how important people will feel this to be, but I've occasionally\n> found it interesting to see how many people are using various different\n> versions of git in a particular development community, and having the\n> version in the signature is a useful gauge on that.\n\nThe original motivation of the version signature was exactly that ;-).\n\n> Putting it in the cover\n> letter isn't really a complete substitute for this because many patches\n> and short patch series go out without cover letters...\n\nI think you misread Stephen, he misspoke, or I misread the patch.  The\nintention of the change as I understand it is to put the signature in the\ncover letter, in addition to the patches.\n\nOne bad thing about having the \"signature\" line at the end of patch is\nthat various third party tools mistake it as one extra deleted line.  One\noffender that is most often seen to corrupt patches is Emacs diff mode.\nDoing an equivalent of \"recountdiff\" after it allows the user to edit a\npatch is fine, but it doesn't bother to remember what was in the original\nand what was added/deleted by the user, and instead seems to just recount\nthe result from scratch.\n"},{"id":"143833","messageId":"AANLkTikM8fRb7oeeMrsEfqTzDAYhTJxN63mblhyUXJM6@mail.gmail.com","threadId":"24116","inReplyTo":"7vwrtygbq5.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/2] format-patch: Add a signature option (--signature)","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-06-16T19:43:50Z","receivedAt":"2010-06-16T19:43:50Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"On Wed, Jun 16, 2010 at 9:53 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Theodore Tso <tytso@MIT.EDU> writes:\n>\n>>\n>> I don't know how important people will feel this to be, but I've occasionally\n>> found it interesting to see how many people are using various different\n>> versions of git in a particular development community, and having the\n>> version in the signature is a useful gauge on that.\n>\n> The original motivation of the version signature was exactly that ;-).\n>\n\nAt least with git send-email you get the X-Mailer header and you know\nwhat version is being used. I admit that isn't as visible/useful as\nthe signature though and not everyone is using git send-email.\n\n>\n> I think you misread Stephen, he misspoke, or I misread the patch.  The\n> intention of the change as I understand it is to put the signature in the\n> cover letter, in addition to the patches.\n>\n\nYes, this is one intention. The other intention is to allow me to\ncustomize what that signature is (or to have no signature at all).\nCurrently it replaces the version number.\n\nThe other option is appending the signature to the version number, but\nI thought it looked funny:\n\n    --\n    1.7.0\n\n    Signature goes here\n\nbut now that I look at it again maybe it looks ok.\n\nIf the answer is there should always be the version number in the\nsignature then renaming --signature to --custom-signature or\n--extra-signature or --append-signature would be more clear (albeit\nverbose). Then  --no-*-signature wouldn't imply that you are removing\nthe default version signature (because you can't).\n\nIf the signature is causing problems for third-party tools then maybe\nin some projects they wouldn't want the signature at all and\n--no-signature would be a good option there. It doesn't mean we have\nto add a --signature=<str> option too, instead it could just be a\nboolean option.\n\nThe real question is how useful is it to have the version number\nthere? There are other ways to gauge the version usage and it's opt-in\nso you'll still get some version number coverage.\n"},{"id":"143834","messageId":"7v8w6eelyi.fsf@alter.siamese.dyndns.org","threadId":"24116","inReplyTo":"AANLkTikM8fRb7oeeMrsEfqTzDAYhTJxN63mblhyUXJM6@mail.gmail.com","subject":"Re: [PATCH 1/2] format-patch: Add a signature option (--signature)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-06-16T20:55:49Z","receivedAt":"2010-06-16T20:55:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Boyd <bebarino@gmail.com> writes:\n\n> On Wed, Jun 16, 2010 at 9:53 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Theodore Tso <tytso@MIT.EDU> writes:\n>>\n>>> I don't know how important people will feel this to be, but I've occasionally\n>>> found it interesting to see how many people are using various different\n>>> versions of git in a particular development community, and having the\n>>> version in the signature is a useful gauge on that.\n>>\n>> The original motivation of the version signature was exactly that ;-).\n> ...\n> The real question is how useful is it to have the version number\n> there? There are other ways to gauge the version usage and it's opt-in\n> so you'll still get some version number coverage.\n\nI sent the previous message without finishing that sentence.  I personally\nhave been feeling that the version number there outlived its usefulness\nfor quite some time.\n\nIf others (like Ted) find it useful/amusing/interesting, we may want to\nkeep the default and make sure it is not too easy to customize it away,\nand I think what your patch does is fine.\n\nThanks.\n"}]}