From: Georgi Chorbadzhiyski Date: Thu, 08 Sep 2011 17:14:04 GMT Subject: Re: [PATCH] send-mail: Add option to sleep between sending each email. Message-ID: <4E68F7DC.9010303@unixsol.org> In-Reply-To: On 9/8/11 8:10 PM, Jakub Narebski wrote: > Georgi Chorbadzhiyski writes: >> Around 09/08/2011 04:58 PM, Georgi Chorbadzhiyski scribbled: > [...] >>> In order for this to work, confirmation should be split from send_message() >>> and from a quick look this not seem very easy. Might be easier to just >>> disable the sleep if user was asked for confirmation. It'll be good to >>> not sleep after last email, but main "foreach my $t (@files) {" loop should >>> pass some hint to send_message(). >> >> The attached patch (apply on on top of the original) should implement the >> idea. >> >> -- >> Georgi Chorbadzhiyski >> http://georgi.unixsol.org/ >> diff --git a/git-send-email.perl b/git-send-email.perl >> index 7239fd4..d4559c9 100755 >> --- a/git-send-email.perl >> +++ b/git-send-email.perl >> @@ -1149,7 +1149,7 @@ X-Mailer: git-send-email $gitversion >> } >> } >> >> - if (!$dry_run&& $sleep) { >> + if (!$dry_run&& $sleep&& $message_num< scalar $#files&& $confirm eq 'never') { > ^^^^^^^^^^^^^^ > >> print "Sleeping: $sleep second(s).\n" if (!$quiet); >> sleep($sleep); >> }; > > Errr... what? If we have @files array, then '$#files' is index of > last element in array, which is scalar anyway, and 'scalar $#files' is > a no-op. > > You can get number of elements in array with 'scalar @files', though > _implicit_ scalar context would also work, like e.g. right hand side > of '<' operator. Correct, my perl is rusty and I wasn't sure $#xx was what I needed so so I copied it from "$time = time - scalar $#files;" somewhere in the same file. -- Georgi Chorbadzhiyski http://georgi.unixsol.org/