{"thread":{"id":"28331","subject":"[PATCH] send-mail: Add option to sleep between sending each email.","startedAt":"2011-09-07T20:43:11Z","lastAt":"2011-10-03T20:17:14Z","messageCount":17,"participants":["Georgi Chorbadzhiyski","Ramkumar Ramachandra","Matthieu Moy","Junio C Hamano","mfwitten@gmail.com","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"175034","messageId":"1315428191-9769-1-git-send-email-gf@unixsol.org","threadId":"28331","inReplyTo":null,"subject":"[PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Georgi Chorbadzhiyski","fromEmail":"gf@unixsol.org","sentAt":"2011-09-07T20:43:11Z","receivedAt":"2011-09-07T20:43:11Z","isPatch":true,"sender":{"key":"gf@unixsol.org","avatar":"https://gravatar.com/avatar/ba59b75709f82e71b5fe68e7ad4e57fff0a22762bb70ac125918a97ca1b1b34a?d=mp&s=160"},"body":"Sometimes when sending lots of changes it is not nice\nto send emails as fast as possible. Of course you can\nconfirm each email after waiting couple of seconds but\nthis is not optimal. This patch adds --sleep option\nto git-send-mail and corresponding sendmail.sleep config\nvariable to control how much seconds to wait between\nsending each email. The default is 0 (not wait at all).\n\nSigned-off-by: Georgi Chorbadzhiyski <gf@unixsol.org>\n---\n Documentation/git-send-email.txt |    6 ++++++\n git-send-email.perl              |   13 ++++++++++++-\n 2 files changed, 18 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 327233c..2ceb69f 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -298,6 +298,9 @@ Default is the value of 'sendemail.confirm' configuration value; if that\n is unspecified, default to 'auto' unless any of the suppress options\n have been specified, in which case default to 'compose'.\n \n+--sleep=<seconds>::\n+\tHow many seconds to wait between sending each email.\n+\n --dry-run::\n \tDo everything except actually send the emails.\n \n@@ -349,6 +352,9 @@ sendemail.confirm::\n \tone of 'always', 'never', 'cc', 'compose', or 'auto'. See '--confirm'\n \tin the previous section for the meaning of these values.\n \n+sendemail.sleep::\n+\tSets how many seconds to wait between sending each email.\n+\n EXAMPLE\n -------\n Use gmail as the smtp server\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 98ab33a..7239fd4 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -84,6 +84,7 @@ git send-email [options] <file | directory | rev-list options >\n   Administering:\n     --confirm               <str>  * Confirm recipients before sending;\n                                      auto, cc, compose, always, or never.\n+    --sleep                 <int>  * Sleep <int> seconds between sending mails.\n     --quiet                        * Output one line of info per email.\n     --dry-run                      * Don't actually send the emails.\n     --[no-]validate                * Perform patch sanity checks. Default on.\n@@ -195,7 +196,7 @@ my ($to_cmd, $cc_cmd);\n my ($smtp_server, $smtp_server_port, @smtp_server_options);\n my ($smtp_authuser, $smtp_encryption);\n my ($identity, $aliasfiletype, @alias_files, $smtp_domain);\n-my ($validate, $confirm);\n+my ($validate, $confirm, $sleep);\n my (@suppress_cc);\n my ($auto_8bit_encoding);\n \n@@ -230,6 +231,7 @@ my %config_settings = (\n     \"envelopesender\" => \\$envelope_sender,\n     \"multiedit\" => \\$multiedit,\n     \"confirm\"   => \\$confirm,\n+    \"sleep\" => \\$sleep,\n     \"from\" => \\$sender,\n     \"assume8bitencoding\" => \\$auto_8bit_encoding,\n );\n@@ -304,6 +306,7 @@ my $rc = GetOptions(\"sender|from=s\" => \\$sender,\n \t\t    \"suppress-cc=s\" => \\@suppress_cc,\n \t\t    \"signed-off-cc|signed-off-by-cc!\" => \\$signed_off_by_cc,\n \t\t    \"confirm=s\" => \\$confirm,\n+\t\t    \"sleep:i\" => \\$sleep,\n \t\t    \"dry-run\" => \\$dry_run,\n \t\t    \"envelope-sender=s\" => \\$envelope_sender,\n \t\t    \"thread!\" => \\$thread,\n@@ -405,6 +408,9 @@ if ($confirm_unconfigured) {\n die \"Unknown --confirm setting: '$confirm'\\n\"\n \tunless $confirm =~ /^(?:auto|cc|compose|always|never)/;\n \n+# Set sleep's default value\n+$sleep = 0 if (!defined $sleep);\n+\n # Debugging, print out the suppressions.\n if (0) {\n \tprint \"suppressions:\\n\";\n@@ -1143,6 +1149,11 @@ X-Mailer: git-send-email $gitversion\n \t\t}\n \t}\n \n+\tif (!$dry_run && $sleep) {\n+\t\tprint \"Sleeping: $sleep second(s).\\n\" if (!$quiet);\n+\t\tsleep($sleep);\n+\t};\n+\n \treturn 1;\n }\n \n-- \n1.7.5.1\n"},{"id":"175075","messageId":"CALkWK0kH+pD6ymtt9oWLhT0Bftp4EvtrwTtNVw6mjX0aObb-BQ@mail.gmail.com","threadId":"28331","inReplyTo":"1315428191-9769-1-git-send-email-gf@unixsol.org","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2011-09-08T08:43:49Z","receivedAt":"2011-09-08T08:43:49Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Georgi,\n\nGeorgi Chorbadzhiyski writes:\n> Sometimes when sending lots of changes it is not nice\n> to send emails as fast as possible. Of course you can\n> confirm each email after waiting couple of seconds but\n> this is not optimal. This patch adds --sleep option\n> to git-send-mail and corresponding sendmail.sleep config\n> variable to control how much seconds to wait between\n> sending each email. The default is 0 (not wait at all).\n\nI use git-send-email a lot, and I ask it to print out the list of all\nemails once before confirming.  After confirming, I just switch back\nto Emacs and continue work- in the many instances, I've never actually\nneeded to slow the process down.  If anything, I wished it could\nconcurrently send many emails and do things /faster/ *.   I'm a little\ncurious about why you want to slow it down- is your SMTP server\nconfigured to block you because it suspects that you're trying to\nspam?\n\nThanks.\n\n* I first need to see if SMTP servers today can take in emails at this\nspeed without suspecting spam.\n\n-- Ram\n"},{"id":"175076","messageId":"vpq7h5jtngj.fsf@bauges.imag.fr","threadId":"28331","inReplyTo":"CALkWK0kH+pD6ymtt9oWLhT0Bftp4EvtrwTtNVw6mjX0aObb-BQ@mail.gmail.com","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2011-09-08T09:03:56Z","receivedAt":"2011-09-08T09:03:56Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Ramkumar Ramachandra <artagnon@gmail.com> writes:\n\n> I'm a little curious about why you want to slow it down- is your SMTP\n> server configured to block you because it suspects that you're trying\n> to spam?\n\nThere have been discussion (and IIRC a patch) proposing this already in\nthe past. One advantage of sleeping a bit between each email is that it\nincrease the chances for the receiver to receive the emails in the right\norder.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"175078","messageId":"4E6886B8.8080902@unixsol.org","threadId":"28331","inReplyTo":"CALkWK0kH+pD6ymtt9oWLhT0Bftp4EvtrwTtNVw6mjX0aObb-BQ@mail.gmail.com","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Georgi Chorbadzhiyski","fromEmail":"gf@unixsol.org","sentAt":"2011-09-08T09:11:20Z","receivedAt":"2011-09-08T09:11:20Z","isPatch":true,"sender":{"key":"gf@unixsol.org","avatar":"https://gravatar.com/avatar/ba59b75709f82e71b5fe68e7ad4e57fff0a22762bb70ac125918a97ca1b1b34a?d=mp&s=160"},"body":"Around 09/08/2011 11:43 AM, Ramkumar Ramachandra scribbled:\n> Hi Georgi,\n> \n> Georgi Chorbadzhiyski writes:\n>> Sometimes when sending lots of changes it is not nice\n>> to send emails as fast as possible. Of course you can\n>> confirm each email after waiting couple of seconds but\n>> this is not optimal. This patch adds --sleep option\n>> to git-send-mail and corresponding sendmail.sleep config\n>> variable to control how much seconds to wait between\n>> sending each email. The default is 0 (not wait at all).\n> \n> I use git-send-email a lot, and I ask it to print out the list of all\n> emails once before confirming.  After confirming, I just switch back\n> to Emacs and continue work- in the many instances, I've never actually\n> needed to slow the process down.  If anything, I wished it could\n> concurrently send many emails and do things /faster/ *.   I'm a little\n> curious about why you want to slow it down- is your SMTP server\n> configured to block you because it suspects that you're trying to\n> spam?\n> \n> Thanks.\n> \n> * I first need to see if SMTP servers today can take in emails at this\n> speed without suspecting spam.\n\nIt is not the mail server, it is workaround mainly for web archives and\nMUAs that look at received dates when sorting threads.\n\nWhen they receive a lot of email in one thread very quickly (and out of\norder) they do not thread correctly.\n\nSee for example this: http://mailman.videolan.org/pipermail/dvblast-devel/2011-August/thread.html\nThe thread named: [dvblast-devel] [PATCH 0/4] Post git migration changes\nSee how 1,3,4/4 are not detected to be part of the thread even when\nall headers are set correctly by git-send-email.\n\nProbably my mail server send them out of order and that is why I have\nthe idea to introduce some small delay between sending each email. Easier\non the MTA, works around the possibility to send emails out of order\nthe flip side is that it takes more time.\n\n-- \nGeorgi Chorbadzhiyski\nhttp://georgi.unixsol.org/\n"},{"id":"175081","messageId":"CALkWK0nuLHpG9xqAAVL4T21N-31m7=A3_amp7Mf0Sw9jobYDRg@mail.gmail.com","threadId":"28331","inReplyTo":"vpq7h5jtngj.fsf@bauges.imag.fr","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2011-09-08T09:28:56Z","receivedAt":"2011-09-08T09:28:56Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Matthieu and Georgi,\n\nMatthieu Moy writes:\n> There have been discussion (and IIRC a patch) proposing this already in\n> the past. One advantage of sleeping a bit between each email is that it\n> increase the chances for the receiver to receive the emails in the right\n> order.\n\nAh, it looks like I missed the earlier discussion/ patch- sorry.  Yes,\nI've also wondered what to do about the order in which patches appear\nin reply to the cover letter- I was of the opinion that it was a minor\ninconvenience that we have to put up with that until SMTP servers\nlearn to fix these things.  Slowing things down a little bit for now\nuntil they catch up is probably a good idea.\n\nGeorgi Chorbadzhiyski writes:\n> See for example this: http://mailman.videolan.org/pipermail/dvblast-devel/2011-August/thread.html\n> The thread named: [dvblast-devel] [PATCH 0/4] Post git migration changes\n> See how 1,3,4/4 are not detected to be part of the thread even when\n> all headers are set correctly by git-send-email.\n\nThis is a far more serious problem.  For this, I was toying with the\nidea of special cover-letter handling in git-send-email.  My idea was\nthat it should essentially send the cover letter, wait for a second\nand then send all the other emails concurrently.  Sure, slowing the\nentire process down would work too, but it's not so elegant.\n\nThanks.\n\n-- Ram\n"},{"id":"175083","messageId":"CALkWK0nt4PXfBxGcAnavUkKM6AhKpZnw1NtZsNznzmGZiguFqA@mail.gmail.com","threadId":"28331","inReplyTo":"CALkWK0nuLHpG9xqAAVL4T21N-31m7=A3_amp7Mf0Sw9jobYDRg@mail.gmail.com","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2011-09-08T09:35:05Z","receivedAt":"2011-09-08T09:35:05Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi again,\n\nRamkumar Ramachandra writes:\n> [...]\n> Yes,\n> I've also wondered what to do about the order in which patches appear\n> in reply to the cover letter- I was of the opinion that it was a minor\n> inconvenience that we have to put up with that until SMTP servers\n> learn to fix these things.\n\nAnother small thought- it'll probably be a good idea to teach\ninterfaces like Gmane and your email client some special rules: If the\nX-Mailer is git-send-email or if the subject field matches [.*PATCH\n(\\d+)/\\d+], sort the email thread by \\1.  Thoughts?\n\nThanks.\n\n-- Ram\n"},{"id":"175085","messageId":"CALkWK0mNBG8EwysjO8uoR+fU5ZM=Pz9es3t_+s6cFgR6NSodGQ@mail.gmail.com","threadId":"28331","inReplyTo":"CALkWK0nt4PXfBxGcAnavUkKM6AhKpZnw1NtZsNznzmGZiguFqA@mail.gmail.com","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2011-09-08T10:44:18Z","receivedAt":"2011-09-08T10:44:18Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi,\n\nI mocked up a small patch to demonstrate the \"special cover letter\nhandling\" idea.  Let me know if you think it's worth pursuing.\nWarning: Untested.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n\n-- 8< --\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 98ab33a..30b8651 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -80,6 +80,7 @@ git send-email [options] <file | directory |\nrev-list options >\n     --[no-]suppress-from           * Send to self. Default off.\n     --[no-]chain-reply-to          * Chain In-Reply-To: fields. Default off.\n     --[no-]thread                  * Use In-Reply-To: field. Default on.\n+    --[no-]initial-wait     <int>  * Wait <int> seconds after sending\nfirst email.\n\n   Administering:\n     --confirm               <str>  * Confirm recipients before sending;\n@@ -190,7 +191,7 @@ sub do_edit {\n }\n\n # Variables with corresponding config settings\n-my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc);\n+my ($thread, $initial_wait, $chain_reply_to, $suppress_from,\n$signed_off_by_cc);\n my ($to_cmd, $cc_cmd);\n my ($smtp_server, $smtp_server_port, @smtp_server_options);\n my ($smtp_authuser, $smtp_encryption);\n@@ -205,6 +206,7 @@ my $not_set_by_user = \"true but not set by the user\";\n\n my %config_bool_settings = (\n     \"thread\" => [\\$thread, 1],\n+    \"initialwait\" => [\\$initial_wait, 0],\n     \"chainreplyto\" => [\\$chain_reply_to, $not_set_by_user],\n     \"suppressfrom\" => [\\$suppress_from, undef],\n     \"signedoffbycc\" => [\\$signed_off_by_cc, undef],\n@@ -1141,6 +1143,11 @@ X-Mailer: git-send-email $gitversion\n \t\t} else {\n \t\t\tprint \"Result: OK\\n\";\n \t\t}\n+\t\tif ($initial_wait) {\n+\t\t\tprint \"Sleeping: $initial_wait seconds.\\n\" if (!$quiet);\n+\t\t\tsleep($initial_wait);\n+\t\t\t$initial_wait = 0;\n+\t\t}\n \t}\n\n \treturn 1;\n"},{"id":"175086","messageId":"4E689F81.6000305@unixsol.org","threadId":"28331","inReplyTo":"CALkWK0mNBG8EwysjO8uoR+fU5ZM=Pz9es3t_+s6cFgR6NSodGQ@mail.gmail.com","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Georgi Chorbadzhiyski","fromEmail":"gf@unixsol.org","sentAt":"2011-09-08T10:57:05Z","receivedAt":"2011-09-08T10:57:05Z","isPatch":true,"sender":{"key":"gf@unixsol.org","avatar":"https://gravatar.com/avatar/ba59b75709f82e71b5fe68e7ad4e57fff0a22762bb70ac125918a97ca1b1b34a?d=mp&s=160"},"body":"Around 09/08/2011 01:44 PM, Ramkumar Ramachandra scribbled:\n> I mocked up a small patch to demonstrate the \"special cover letter\n> handling\" idea.  Let me know if you think it's worth pursuing.\n> Warning: Untested.\n> \n> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n> \n> -- 8< --\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 98ab33a..30b8651 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -80,6 +80,7 @@ git send-email [options] <file | directory |\n> rev-list options >\n>      --[no-]suppress-from           * Send to self. Default off.\n>      --[no-]chain-reply-to          * Chain In-Reply-To: fields. Default off.\n>      --[no-]thread                  * Use In-Reply-To: field. Default on.\n> +    --[no-]initial-wait     <int>  * Wait <int> seconds after sending\n> first email.\n> \n>    Administering:\n>      --confirm               <str>  * Confirm recipients before sending;\n> @@ -190,7 +191,7 @@ sub do_edit {\n>  }\n> \n>  # Variables with corresponding config settings\n> -my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc);\n> +my ($thread, $initial_wait, $chain_reply_to, $suppress_from,\n> $signed_off_by_cc);\n>  my ($to_cmd, $cc_cmd);\n>  my ($smtp_server, $smtp_server_port, @smtp_server_options);\n>  my ($smtp_authuser, $smtp_encryption);\n> @@ -205,6 +206,7 @@ my $not_set_by_user = \"true but not set by the user\";\n> \n>  my %config_bool_settings = (\n>      \"thread\" => [\\$thread, 1],\n> +    \"initialwait\" => [\\$initial_wait, 0],\n>      \"chainreplyto\" => [\\$chain_reply_to, $not_set_by_user],\n>      \"suppressfrom\" => [\\$suppress_from, undef],\n>      \"signedoffbycc\" => [\\$signed_off_by_cc, undef],\n> @@ -1141,6 +1143,11 @@ X-Mailer: git-send-email $gitversion\n>  \t\t} else {\n>  \t\t\tprint \"Result: OK\\n\";\n>  \t\t}\n> +\t\tif ($initial_wait) {\n> +\t\t\tprint \"Sleeping: $initial_wait seconds.\\n\" if (!$quiet);\n> +\t\t\tsleep($initial_wait);\n> +\t\t\t$initial_wait = 0;\n> +\t\t}\n>  \t}\n> \n>  \treturn 1;\n\nI don't see how this would solve the problem that MTA can send\nemails after the first one out of order.\n\n-- \nGeorgi Chorbadzhiyski\nhttp://georgi.unixsol.org/\n"},{"id":"175087","messageId":"vpq39g7gua3.fsf@bauges.imag.fr","threadId":"28331","inReplyTo":"CALkWK0mNBG8EwysjO8uoR+fU5ZM=Pz9es3t_+s6cFgR6NSodGQ@mail.gmail.com","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2011-09-08T11:15:00Z","receivedAt":"2011-09-08T11:15:00Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Ramkumar Ramachandra <artagnon@gmail.com> writes:\n\n> Hi,\n>\n> I mocked up a small patch to demonstrate the \"special cover letter\n> handling\" idea.  Let me know if you think it's worth pursuing.\n\nIf it was really a problem to have to wait a few seconds/minutes more,\nI'd consider it as an interesting compromise (allow [PATCH 1/2] to come\nafter [PATCH 2/2] but make sure they both come after the coverletter to\nmake sure the recipient notice they're part of the same thread).\n\nBut quite frankly, I don't think it's worth the trouble.\n\nAs you said, the normal workflow is to use \"git send-email\", and go back\nto work after, so you can do something else while the emails are being\nsent (see below [1]). I don't think bothering users with --sleep and\n--initial-wait is worth the benefit of having both possibilities. People\nworried about email order should be fine with --sleep.\n\n[1] Actually, I think there's a problem with Georgi's patch. If I read\ncorrectly, the sleep is inserted within the confirmation loop, which\nmeans the user will have\n\nsend this email? yes\nsending email\nsleeping 10 seconds\nsend this email? yes\nsending email\nsleeping 10 seconds\n...\n\nwhile it should be\n\nsend this email? yes\nok, I'll send it later\nsend this email? yes\nok, I'll send it later\nsending first email ...\nsleeping 10 seconds\nsending second email\ndone.\n\n(i.e. don't force the user to wait between confirmations, and don't wait\nafter the last email)\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"175093","messageId":"4E68CA0C.5080702@unixsol.org","threadId":"28331","inReplyTo":"vpq39g7gua3.fsf@bauges.imag.fr","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Georgi Chorbadzhiyski","fromEmail":"gf@unixsol.org","sentAt":"2011-09-08T13:58:36Z","receivedAt":"2011-09-08T13:58:36Z","isPatch":true,"sender":{"key":"gf@unixsol.org","avatar":"https://gravatar.com/avatar/ba59b75709f82e71b5fe68e7ad4e57fff0a22762bb70ac125918a97ca1b1b34a?d=mp&s=160"},"body":"Around 09/08/2011 02:15 PM, Matthieu Moy scribbled:\n> [1] Actually, I think there's a problem with Georgi's patch. If I read\n> correctly, the sleep is inserted within the confirmation loop, which\n> means the user will have\n> \n> send this email? yes\n> sending email\n> sleeping 10 seconds\n> send this email? yes\n> sending email\n> sleeping 10 seconds\n> ...\n> \n> while it should be\n> \n> send this email? yes\n> ok, I'll send it later\n> send this email? yes\n> ok, I'll send it later\n> sending first email ...\n> sleeping 10 seconds\n> sending second email\n> done.\n> \n> (i.e. don't force the user to wait between confirmations, and don't wait\n> after the last email)\n\nIn order for this to work, confirmation should be split from send_message()\nand from a quick look this not seem very easy. Might be easier to just\ndisable the sleep if user was asked for confirmation. It'll be good to\nnot sleep after last email, but main \"foreach my $t (@files) {\" loop should\npass some hint to send_message().\n\n-- \nGeorgi Chorbadzhiyski\nhttp://georgi.unixsol.org/\n"},{"id":"175094","messageId":"4E68CC08.4040201@unixsol.org","threadId":"28331","inReplyTo":"4E68CA0C.5080702@unixsol.org","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Georgi Chorbadzhiyski","fromEmail":"gf@unixsol.org","sentAt":"2011-09-08T14:07:04Z","receivedAt":"2011-09-08T14:07:04Z","isPatch":true,"sender":{"key":"gf@unixsol.org","avatar":"https://gravatar.com/avatar/ba59b75709f82e71b5fe68e7ad4e57fff0a22762bb70ac125918a97ca1b1b34a?d=mp&s=160"},"body":"Around 09/08/2011 04:58 PM, Georgi Chorbadzhiyski scribbled:\n> Around 09/08/2011 02:15 PM, Matthieu Moy scribbled:\n>> [1] Actually, I think there's a problem with Georgi's patch. If I read\n>> correctly, the sleep is inserted within the confirmation loop, which\n>> means the user will have\n>>\n>> send this email? yes\n>> sending email\n>> sleeping 10 seconds\n>> send this email? yes\n>> sending email\n>> sleeping 10 seconds\n>> ...\n>>\n>> while it should be\n>>\n>> send this email? yes\n>> ok, I'll send it later\n>> send this email? yes\n>> ok, I'll send it later\n>> sending first email ...\n>> sleeping 10 seconds\n>> sending second email\n>> done.\n>>\n>> (i.e. don't force the user to wait between confirmations, and don't wait\n>> after the last email)\n> \n> In order for this to work, confirmation should be split from send_message()\n> and from a quick look this not seem very easy. Might be easier to just\n> disable the sleep if user was asked for confirmation. It'll be good to\n> not sleep after last email, but main \"foreach my $t (@files) {\" loop should\n> pass some hint to send_message().\n\nThe attached patch (apply on on top of the original) should implement the\nidea.\n\n-- \nGeorgi Chorbadzhiyski\nhttp://georgi.unixsol.org/\n\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 7239fd4..d4559c9 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1149,7 +1149,7 @@ X-Mailer: git-send-email $gitversion\n \t\t}\n \t}\n \n-\tif (!$dry_run && $sleep) {\n+\tif (!$dry_run && $sleep && $message_num < scalar $#files && $confirm eq 'never') {\n \t\tprint \"Sleeping: $sleep second(s).\\n\" if (!$quiet);\n \t\tsleep($sleep);\n \t};\n"},{"id":"175120","messageId":"7vbouvx8j5.fsf@alter.siamese.dyndns.org","threadId":"28331","inReplyTo":"vpq7h5jtngj.fsf@bauges.imag.fr","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-09-08T17:12:46Z","receivedAt":"2011-09-08T17:12:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> There have been discussion (and IIRC a patch) proposing this already in\n> the past. One advantage of sleeping a bit between each email is that it\n> increase the chances for the receiver to receive the emails in the right\n> order.\n\nHuh? Even in the presense of MTAs in the middle that are free to reorder\nmessages?\n\nIIRC, \"git send-email\" does its best to force ordering by assigning\nmonotonically increasing timestamps on the Date: field, so that the\nrecipients can sort the messages based on it, in addition to the\nIn-Reply-To field to help threading. I personally do not think there is\nanything more than that that should done in the program.\n"},{"id":"175127","messageId":"4E68F7DC.9010303@unixsol.org","threadId":"28331","inReplyTo":"m37h5jt19v.fsf@localhost.localdomain","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Georgi Chorbadzhiyski","fromEmail":"gf@unixsol.org","sentAt":"2011-09-08T17:14:04Z","receivedAt":"2011-09-08T17:14:04Z","isPatch":true,"sender":{"key":"gf@unixsol.org","avatar":"https://gravatar.com/avatar/ba59b75709f82e71b5fe68e7ad4e57fff0a22762bb70ac125918a97ca1b1b34a?d=mp&s=160"},"body":"On 9/8/11 8:10 PM, Jakub Narebski wrote:\n> Georgi Chorbadzhiyski<gf@unixsol.org>  writes:\n>> Around 09/08/2011 04:58 PM, Georgi Chorbadzhiyski scribbled:\n> [...]\n>>> In order for this to work, confirmation should be split from send_message()\n>>> and from a quick look this not seem very easy. Might be easier to just\n>>> disable the sleep if user was asked for confirmation. It'll be good to\n>>> not sleep after last email, but main \"foreach my $t (@files) {\" loop should\n>>> pass some hint to send_message().\n>>\n>> The attached patch (apply on on top of the original) should implement the\n>> idea.\n>>\n>> --\n>> Georgi Chorbadzhiyski\n>> http://georgi.unixsol.org/\n>> diff --git a/git-send-email.perl b/git-send-email.perl\n>> index 7239fd4..d4559c9 100755\n>> --- a/git-send-email.perl\n>> +++ b/git-send-email.perl\n>> @@ -1149,7 +1149,7 @@ X-Mailer: git-send-email $gitversion\n>>   \t\t}\n>>   \t}\n>>\n>> -\tif (!$dry_run&&  $sleep) {\n>> +\tif (!$dry_run&&  $sleep&&  $message_num<  scalar $#files&&  $confirm eq 'never') {\n>                                                    ^^^^^^^^^^^^^^\n>\n>>   \t\tprint \"Sleeping: $sleep second(s).\\n\" if (!$quiet);\n>>   \t\tsleep($sleep);\n>>   \t};\n>\n> Errr... what?  If we have @files array, then '$#files' is index of\n> last element in array, which is scalar anyway, and 'scalar $#files' is\n> a no-op.\n>\n> You can get number of elements in array with 'scalar @files', though\n> _implicit_ scalar context would also work, like e.g. right hand side\n> of '<' operator.\n\nCorrect, my perl is rusty and I wasn't sure $#xx was what I needed so\nso I copied it from \"$time = time - scalar $#files;\" somewhere in\nthe same file.\n\n-- \nGeorgi Chorbadzhiyski\nhttp://georgi.unixsol.org/\n"},{"id":"175124","messageId":"vpq39g6iws4.fsf@bauges.imag.fr","threadId":"28331","inReplyTo":"7vbouvx8j5.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2011-09-08T20:50:19Z","receivedAt":"2011-09-08T20:50:19Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n>\n>> There have been discussion (and IIRC a patch) proposing this already in\n>> the past. One advantage of sleeping a bit between each email is that it\n>> increase the chances for the receiver to receive the emails in the right\n>> order.\n>\n> Huh? Even in the presense of MTAs in the middle that are free to reorder\n> messages?\n\nI didn't say it _ensures_ reception in the right order. I said it\nincreases the chances.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"175145","messageId":"eba7fd939a4945a9bfe18afc125c3962-mfwitten@gmail.com","threadId":"28331","inReplyTo":"7vbouvx8j5.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"","fromEmail":"mfwitten@gmail.com","sentAt":null,"receivedAt":"2011-09-09T02:02:46Z","isPatch":true,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Thu, 08 Sep 2011 10:12:46 -0700, Junio C Hamano wrote:\n\n> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n>\n>> There have been discussion (and IIRC a patch) proposing this already in\n>> the past. One advantage of sleeping a bit between each email is that it\n>> increase the chances for the receiver to receive the emails in the right\n>> order.\n>\n> Huh? Even in the presense of MTAs in the middle that are free to reorder\n> messages?\n>\n> IIRC, \"git send-email\" does its best to force ordering by assigning\n> monotonically increasing timestamps on the Date: field, so that the\n> recipients can sort the messages based on it, in addition to the\n> In-Reply-To field to help threading. I personally do not think there is\n> anything more than that that should done in the program.\n\nThe previous, rather lengthy discussion involved my patch and took place\nover 2 years ago. The thread starts here:\n\n  Message-ID: <1239139522-24118-1-git-send-email-mfwitten@gmail.com?\n  http://thread.gmane.org/gmane.comp.version-control.git/115988\n\ncontinues here (because of my email header mistake):\n\n  Message-ID: <49dcb464.06d7720a.66ca.ffffbd30@mx.google.com>\n  http://thread.gmane.org/gmane.comp.version-control.git/116083\n\nand ultimately, the final patch review was proferred here:\n\n  Message-Id: <1239647037-15381-11-git-send-email-mfwitten@gmail.com>\n  http://article.gmane.org/gmane.comp.version-control.git/116471\n\n>From a quick glance, my patch would appear to have become more advanced,\nas per your own request, Junio:\n\n  Message-ID: <7vskkh1va5.fsf@gitster.siamese.dyndns.org>\n  http://thread.gmane.org/gmane.comp.version-control.git/116083\n\nHere's the documentation I wrote for it:\n\n  diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\n  index 5f7d640..236e578 100644\n  --- a/Documentation/git-send-email.txt\n  +++ b/Documentation/git-send-email.txt\n  @@ -178,6 +178,36 @@ Automating\n   \tcc list. Default is the value of 'sendemail.signedoffbycc' configuration\n   \tvalue; if that is unspecified, default to --signed-off-by-cc.\n   \n  +--sleep=<seconds>[,<burst>]::\n  +\tThis option specfies that send-email should sleep for <seconds>\n  +\tafter sending <burst> messages as quickly as possible; <seconds>\n  +\tshould be an integer >= 0 and <burst> should be an integer >= 1.\n  +\tThis mode of operation attacks 2 problems: email throttling and\n  +\tarrival disorder. Default is the value of the 'sendemail.sleep'\n  +\tconfiguration variable, or '0' if that does not exist.\n  ++\n  +By default, send-email tries to send one patch per email as quickly as\n  +possible. Unfortunately, some email services restrict a user by refusing\n  +to send more than some maximum number of email messages, M, in a given\n  +period of seconds, S. This can be troublesome if the patch series has\n  +more than M patches, because the server will ultimately refuse to send\n  +some of them. In this case, simply pass '--sleep=S,M' or '--sleep S,M'\n  +or set sendemail.sleep to 'S,M'.\n  ++\n  +Moreover, the emails often arrive at the final destination out of order;\n  +though send-email manipulates the date fields and usually chains subsequent\n  +emails via the In-Reply-To headers, some mail viewers nevertheless insist\n  +on presenting them by order of arrival. This may be mitigated by using\n  +something like '--sleep 60' (the equivalent of '--sleep 60,1'), so that\n  +there is a 60 second delay between sending any two messages.\n  ++\n  +*Note*: Because of varying routes and batching schemes, there is no delay\n  +that can guarantee the correct arrival order. Obviously, one solution is to\n  +choose an obscenely large number, so be prepared to run send-email in the\n  +background. Of course, spreading emails across time makes it more likely\n  +that unrelated email messages arrive between patches. Therefore, send-email\n  +warns you if both --sleep and --no-chain-reply-to are used.\n  +\n   --suppress-cc=<category>::\n   \tSpecify an additional category of recipients to suppress the\n   \tauto-cc of:\n\nSincerely,\nMichael Witten\n"},{"id":"175327","messageId":"CALkWK0=CT_vsWZ6K_DhrL8rNcCEK-Hr9E_t3pgVdhkss4Oi0yg@mail.gmail.com","threadId":"28331","inReplyTo":"7vbouvx8j5.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2011-09-12T05:34:44Z","receivedAt":"2011-09-12T05:34:44Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi,\n\nMichael Witten writes:\n> [...]\n> From a quick glance, my patch would appear to have become more advanced,\n> as per your own request, Junio:\n>\n>  Message-ID: <7vskkh1va5.fsf@gitster.siamese.dyndns.org>\n>  http://thread.gmane.org/gmane.comp.version-control.git/116083\n\nWow, that was over two years ago.  I only started contributing to Git\na little over a year and a half ago: no wonder I missed the\ndiscussion.  Thanks for digging it out.\n\nJunio C Hamano writes:\n> [...]\n> IIRC, \"git send-email\" does its best to force ordering by assigning\n> monotonically increasing timestamps on the Date: field, so that the\n> recipients can sort the messages based on it, in addition to the\n> In-Reply-To field to help threading. I personally do not think there is\n> anything more than that that should done in the program.\n\nI agree with Junio here.  However, I realize that the patch adds some\nvalue: perhaps we can have it as a script under 'contrib/'?\n\nThanks.\n\n-- Ram\n"},{"id":"176788","messageId":"m37h5jt19v.fsf@localhost.localdomain","threadId":"28331","inReplyTo":"4E68CC08.4040201@unixsol.org","subject":"Re: [PATCH] send-mail: Add option to sleep between sending each email.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2011-10-03T20:17:14Z","receivedAt":"2011-10-03T20:17:14Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Georgi Chorbadzhiyski <gf@unixsol.org> writes:\n> Around 09/08/2011 04:58 PM, Georgi Chorbadzhiyski scribbled:\n[...]\n> > In order for this to work, confirmation should be split from send_message()\n> > and from a quick look this not seem very easy. Might be easier to just\n> > disable the sleep if user was asked for confirmation. It'll be good to\n> > not sleep after last email, but main \"foreach my $t (@files) {\" loop should\n> > pass some hint to send_message().\n> \n> The attached patch (apply on on top of the original) should implement the\n> idea.\n> \n> -- \n> Georgi Chorbadzhiyski\n> http://georgi.unixsol.org/\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 7239fd4..d4559c9 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -1149,7 +1149,7 @@ X-Mailer: git-send-email $gitversion\n>  \t\t}\n>  \t}\n>  \n> -\tif (!$dry_run && $sleep) {\n> +\tif (!$dry_run && $sleep && $message_num < scalar $#files && $confirm eq 'never') {\n                                                  ^^^^^^^^^^^^^^\n\n>  \t\tprint \"Sleeping: $sleep second(s).\\n\" if (!$quiet);\n>  \t\tsleep($sleep);\n>  \t};\n\nErrr... what?  If we have @files array, then '$#files' is index of\nlast element in array, which is scalar anyway, and 'scalar $#files' is\na no-op.\n\nYou can get number of elements in array with 'scalar @files', though\n_implicit_ scalar context would also work, like e.g. right hand side\nof '<' operator.\n\n-- \nJakub Narębski\n"}]}