{"thread":{"id":"22682","subject":"[PATCH] Add 'git format-patch --to=' option and 'format.to' configuration variable.","startedAt":"2010-02-16T23:39:34Z","lastAt":"2010-02-18T10:15:02Z","messageCount":7,"participants":["Steven Drake","Junio C Hamano","Peter Krefting"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"134809","messageId":"alpine.LNX.2.00.1002171238310.2477@vqena.qenxr.bet.am","threadId":"22682","inReplyTo":null,"subject":"[PATCH] Add 'git format-patch --to=' option and 'format.to' configuration variable.","fromName":"Steven Drake","fromEmail":"sdrake@xnet.co.nz","sentAt":"2010-02-16T23:39:34Z","receivedAt":"2010-02-16T23:39:34Z","isPatch":true,"sender":{"key":"sdrake@xnet.co.nz","avatar":null},"body":"Has the same functionality as the '--cc' option and 'format.cc'\nconfiguration variable but for the \"To:\" email header.  Half of the code to\nsupport this was already there.\n\nWith email the To: header usually more important than the Cc: header.\n\nSigned-off-by: Steven Drake <sdrake@xnet.co.nz>\n---\n Documentation/git-format-patch.txt |   11 ++++++++---\n builtin-log.c                      |   16 ++++++++++++++++\n 2 files changed, 24 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\nindex f1fd0df..e936d71 100644\n--- a/Documentation/git-format-patch.txt\n+++ b/Documentation/git-format-patch.txt\n@@ -18,7 +18,7 @@ SYNOPSIS\n \t\t   [--in-reply-to=Message-Id] [--suffix=.<sfx>]\n \t\t   [--ignore-if-in-upstream]\n \t\t   [--subject-prefix=Subject-Prefix]\n-\t\t   [--cc=<email>]\n+\t\t   [--to=<email>] [--cc=<email>]\n \t\t   [--cover-letter]\n \t\t   [<common diff options>]\n \t\t   [ <since> | <revision range> ]\n@@ -162,6 +162,10 @@ will want to ensure that threading is disabled for `git send-email`.\n \tallows for useful naming of a patch series, and can be\n \tcombined with the `--numbered` option.\n \n+--to=<email>::\n+\tAdd a `To:` header to the email headers. This is in addition\n+\tto any configured headers, and may be used multiple times.\n+\n --cc=<email>::\n \tAdd a `Cc:` header to the email headers. This is in addition\n \tto any configured headers, and may be used multiple times.\n@@ -202,8 +206,8 @@ CONFIGURATION\n -------------\n You can specify extra mail header lines to be added to each message,\n defaults for the subject prefix and file suffix, number patches when\n-outputting more than one patch, add \"Cc:\" headers, configure attachments,\n-and sign off patches with configuration variables.\n+outputting more than one patch, add \"To\" or \"Cc:\" headers, configure\n+attachments, and sign off patches with configuration variables.\n \n ------------\n [format]\n@@ -211,6 +215,7 @@ and sign off patches with configuration variables.\n \tsubjectprefix = CHANGE\n \tsuffix = .txt\n \tnumbered = auto\n+\tto = <email>\n \tcc = <email>\n \tattach [ = mime-boundary-string ]\n \tsignoff = true\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 41b6df4..89f8d60 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -501,6 +501,13 @@ static int git_format_config(const char *var, const char *value, void *cb)\n \t}\n \tif (!strcmp(var, \"format.suffix\"))\n \t\treturn git_config_string(&fmt_patch_suffix, var, value);\n+\tif (!strcmp(var, \"format.to\")) {\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(var);\n+\t\tALLOC_GROW(extra_to, extra_to_nr + 1, extra_to_alloc);\n+\t\textra_to[extra_to_nr++] = xstrdup(value);\n+\t\treturn 0;\n+\t}\n \tif (!strcmp(var, \"format.cc\")) {\n \t\tif (!value)\n \t\t\treturn config_error_nonbool(var);\n@@ -872,6 +879,13 @@ static int header_callback(const struct option *opt, const char *arg, int unset)\n \treturn 0;\n }\n \n+static int to_callback(const struct option *opt, const char *arg, int unset)\n+{\n+\tALLOC_GROW(extra_to, extra_to_nr + 1, extra_to_alloc);\n+\textra_to[extra_to_nr++] = xstrdup(arg);\n+\treturn 0;\n+}\n+\n static int cc_callback(const struct option *opt, const char *arg, int unset)\n {\n \tALLOC_GROW(extra_cc, extra_cc_nr + 1, extra_cc_alloc);\n@@ -936,6 +950,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t{ OPTION_CALLBACK, 0, \"add-header\", NULL, \"header\",\n \t\t\t    \"add email header\", PARSE_OPT_NONEG,\n \t\t\t    header_callback },\n+\t\t{ OPTION_CALLBACK, 0, \"to\", NULL, \"email\", \"add To: header\",\n+\t\t\t    PARSE_OPT_NONEG, to_callback },\n \t\t{ OPTION_CALLBACK, 0, \"cc\", NULL, \"email\", \"add Cc: header\",\n \t\t\t    PARSE_OPT_NONEG, cc_callback },\n \t\tOPT_STRING(0, \"in-reply-to\", &in_reply_to, \"message-id\",\n-- \n1.6.6\n"},{"id":"134826","messageId":"7vhbpgpsto.fsf@alter.siamese.dyndns.org","threadId":"22682","inReplyTo":"alpine.LNX.2.00.1002171238310.2477@vqena.qenxr.bet.am","subject":"Re: [PATCH] Add 'git format-patch --to=' option and 'format.to' configuration variable.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-17T01:13:55Z","receivedAt":"2010-02-17T01:13:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Steven Drake <sdrake@xnet.co.nz> writes:\n\n> Has the same functionality as the '--cc' option and 'format.cc'\n> configuration variable but for the \"To:\" email header.  Half of the code to\n> support this was already there.\n\nI don't _mind_ adding such a config (I didn't check the patch text,\nthough), but one thing I don't understand is what kind of workflow do\npeople who use format.cc, format.to, --cc and --to are using.\n\nMy impression has always been that you drive your _MUA_ to set these\nvalues, and MUAs are either (1) not so cooperating to read these headers\nfrom format-patch output and use them to decide where to send mails from,\nor (2) is a git-send-email which is customizable already per repository so\nyou do not have to do anything funky when running format-patch.\n\nHow are you sending your output from format-patch, and how does having To:\nand Cc: header pregenerated by format-patch help you?\n"},{"id":"134833","messageId":"alpine.LNX.2.00.1002171516520.3414@vqena.qenxr.bet.am","threadId":"22682","inReplyTo":"7vhbpgpsto.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Add 'git format-patch --to=' option and 'format.to' configuration variable.","fromName":"Steven Drake","fromEmail":"sdrake@xnet.co.nz","sentAt":"2010-02-17T03:11:30Z","receivedAt":"2010-02-17T03:11:30Z","isPatch":true,"sender":{"key":"sdrake@xnet.co.nz","avatar":null},"body":"On Tue, 16 Feb 2010, Junio C Hamano wrote:\n\n> I don't _mind_ adding such a config (I didn't check the patch text,\n> though), but one thing I don't understand is what kind of workflow do\n> people who use format.cc, format.to, --cc and --to are using.\n\nIn the commit that add '--cc', Daniel Barkalow wrote:\n> When you have particular reviewers you want to sent particular series\n> to, it's nice to be able to generate the whole series with them as\n> additional recipients, without configuring them into your general\n> headers or adding them by hand afterwards.\n\nIn the commit that added 'format.cc' Miklos Vajna wrote:\n> Some projects prefer to always CC patches to a given mailing list. In\n> these cases, it's handy to configure that address once.\n\nI think it's weired to have an option & config variable for Cc and not To.\n\n> My impression has always been that you drive your _MUA_ to set these\n> values, and MUAs are either (1) not so cooperating to read these headers\n> from format-patch output and use them to decide where to send mails from,\nAny MUA that does not cooperate with reading the To header is going to\ngive trouble with any header (e.g. Subject, Date).\n\n> or (2) is a git-send-email which is customizable already per repository so\n> you do not have to do anything funky when running format-patch.\nHaven't got around to using git-send-email yet!\n\n> [...] how does having To:\n> and Cc: header pregenerated by format-patch help you?\nMostly having to remember/lookup the email address.\n\n-- \nSteven\n"},{"id":"134834","messageId":"7vhbpgfrqj.fsf@alter.siamese.dyndns.org","threadId":"22682","inReplyTo":"alpine.LNX.2.00.1002171516520.3414@vqena.qenxr.bet.am","subject":"Re: [PATCH] Add 'git format-patch --to=' option and 'format.to' configuration variable.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-17T03:47:32Z","receivedAt":"2010-02-17T03:47:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Steven Drake <sdrake@xnet.co.nz> writes:\n\n> I think it's weired to have an option & config variable for Cc and not To.\n\nThis line in your message I agree with 100%, and I already said I do _not_\nmind adding format.to or --to.  But a sad thing is, this one line is the\nonly one I agree with in your message.\n\nAll the other lines including what your quoted in your message do not\nanswer my question at all.  Neither description by Daniel nor by Miklos\nexplains how giving format.cc or --cc given to format-patch helps the user\nin the bigger picture.  Is a user of this feature expected to always use\nsend-email?  If so, how is that different from giving these options to\nsend-email instead?\n\n> Any MUA that does not cooperate with reading the To header is going to\n> give trouble with any header (e.g. Subject, Date).\n\nYes, --cc/--to/format.cc/format.are not about helping users of these\nuncooperating MUAs, and that is perfectly fine.  \"It is bad that the\nfeature does not to help them\" is not what I am saying.  I am only trying\nto find what these features are designed to help.  If the set of MUAs that\nare helped by this feature is larger than \"git send-email\" by an iota, I'd\nbe happy.\n\n>> or (2) is a git-send-email which is customizable already per repository so\n>> you do not have to do anything funky when running format-patch.\n> Haven't got around to using git-send-email yet!\n\nThen how would having To: and Cc: help in the format-patch output help you\nat all?  I tried to ask you (apparently in a garbled grammar, sorry) what\nyour workflow of sending the format-patch output to the outside world is.\n\nThe reason why I am asking is _not_ because I want to reject this patch.\nI want to be able to explain to other people why it is beneficial to be\nable to specify to/cc setting to format-patch, and using it in what way\nin a larger picture it would help the user.\n\nI.e. saying \"by setting format.to, your output will have these To: header\"\nis not good enough, if we do not make it clear why having the \"To/Cc\" in\nthe output helps users and in what way.\n\nI want to hear \"because the output from format-patch has these To: header,\nyour life gets easier *this way*, if the MUA you use to send out patches\nis ________.  You can use command ______ of the MUA to read the whole\nthing including the headers, and you do not have to type nor remember the\naddresses; this is something you cannot do without using this feature if\nyour favorite MUA is _______.\"\n\nIf that MUA is \"git send-email\", then I would explain to my users \"don't\nworry about these format-patch 'features'; if you are a user of \"git\nsend-email\", then give them to that command instead.\"  Feature duplication\nisn't a bad thing per-se, but I want to know about it.\n"},{"id":"134845","messageId":"alpine.LNX.2.00.1002171706290.5479@vqena.qenxr.bet.am","threadId":"22682","inReplyTo":"7vhbpgfrqj.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Add 'git format-patch --to=' option and 'format.to' configuration variable.","fromName":"Steven Drake","fromEmail":"sdrake@xnet.co.nz","sentAt":"2010-02-17T07:33:38Z","receivedAt":"2010-02-17T07:33:38Z","isPatch":true,"sender":{"key":"sdrake@xnet.co.nz","avatar":null},"body":"On Tue, 16 Feb 2010, Junio C Hamano wrote:\n> I tried to ask you (apparently in a garbled grammar, sorry) what\n> your workflow of sending the format-patch output to the outside world is.\n \n$ ./git-format-patch --stdout master~5..master~1 >>~/mail/postponed-msgs\n$ alpine -I cp\n\nOnly problem with doing that is that alpine changes the Date: and\n Message-Id: header (the later being a pain if I used --threaded).\n\nI don't know about other MUA (or how Daniel or Miklos work) but someone\ncould use a command like:\n\n$ git-format-patch --stdout master~5..master~1 | sendmail -bm -t\n\nBut in all honesty I don't think it matters whether the headers are set by\nformat-patch or send-email and I would understand if you wanted to\ndeprecate '--cc' from format-patch and 'format.cc' (maybe keep it for \nbackwards compat).\n\n-- \nSteven\n"},{"id":"134846","messageId":"7vhbpg5lf0.fsf@alter.siamese.dyndns.org","threadId":"22682","inReplyTo":"alpine.LNX.2.00.1002171706290.5479@vqena.qenxr.bet.am","subject":"Re: [PATCH] Add 'git format-patch --to=' option and 'format.to' configuration variable.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-17T08:14:11Z","receivedAt":"2010-02-17T08:14:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Steven Drake <sdrake@xnet.co.nz> writes:\n\n> On Tue, 16 Feb 2010, Junio C Hamano wrote:\n>> I tried to ask you (apparently in a garbled grammar, sorry) what\n>> your workflow of sending the format-patch output to the outside world is.\n>  \n> $ ./git-format-patch --stdout master~5..master~1 >>~/mail/postponed-msgs\n> $ alpine -I cp\n>\n> Only problem with doing that is that alpine changes the Date: and\n>  Message-Id: header (the later being a pain if I used --threaded).\n\nFinally.  That is the kind of \"how somebody would work with format-patch\noutput\" I was looking for.  Thanks.\n\n> ... I would understand if you wanted to deprecate '--cc' from\n> format-patch and 'format.cc' (maybe keep it for backwards compat).\n\nNo, you took me wrong.  Deprecation wasn't what I was after.\n\nI wanted to see ways to _positively_ explain what format.{cc,to} are good\nfor.  With them, we can eventually have a few examples in EXAMPLES section\nof the manual page to help users (hint, hint...).\n"},{"id":"134944","messageId":"alpine.DEB.2.00.1002181108020.11095@ds9.cixit.se","threadId":"22682","inReplyTo":"7vhbpgpsto.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Add 'git format-patch --to=' option and 'format.to' configuration variable.","fromName":"Peter Krefting","fromEmail":"peter@softwolves.pp.se","sentAt":"2010-02-18T10:15:02Z","receivedAt":"2010-02-18T10:15:02Z","isPatch":true,"sender":{"key":"peter@softwolves.pp.se","avatar":"https://avatars.githubusercontent.com/u/990764?v=4"},"body":"Junio C Hamano:\n\n> How are you sending your output from format-patch, and how does having To: \n> and Cc: header pregenerated by format-patch help you?\n\nThe patches I have sent to the list have all been sent using\n\n   git format-patch something\n   $EDITOR *.patch # remove mbox header, and add To:\n   for file in *.patch ; do sendmail -t < $file ; done\n\nas every attempt I have done to send them through Alpine or other MUAs have \nfailed horribly.\n\nI haven't minded having to edit the patch files manually (since I have also \nvisually inspected the patch files in the process), but being able to add \nthe To: line for the list automatically for each of the patches lessens the \nrisk of misspelling or missing it completely when fixing the patches up.\n\n-- \n\\\\// Peter - http://www.softwolves.pp.se/\n"}]}