811
812
$time = time - scalar $#files;
813
814
-if ($validate) {
815
- # FIFOs can only be read once, exclude them from validation.
816
- my @real_files = ();
817
- foreach my $f (@files) {
818
- unless (-p $f) {
819
- push(@real_files, $f);
820
- }
821
- }
822
-
823
- # Run the loop once again to avoid gaps in the counter due to FIFO
824
- # arguments provided by the user.
825
- my $num = 1;
826
- my $num_files = scalar @real_files;
827
- $ENV{GIT_SENDEMAIL_FILE_TOTAL} = "$num_files";
828
- foreach my $r (@real_files) {
829
- $ENV{GIT_SENDEMAIL_FILE_COUNTER} = "$num";
830
- pre_process_file($r, 1);
831
- validate_patch($r, $target_xfer_encoding);
832
- $num += 1;
833
- }
834
- delete $ENV{GIT_SENDEMAIL_FILE_COUNTER};
835
- delete $ENV{GIT_SENDEMAIL_FILE_TOTAL};
836
-}
837
-
814
@files = handle_backup_files(@files);
815
816
if (@files) {
1740
return 1;
1741
}
1742
1767
-$in_reply_to = $initial_in_reply_to;
1768
-$references = $initial_in_reply_to || '';
1769
-$message_num = 0;
1770
-
1743
sub pre_process_file {
1744
my ($t, $quiet) = @_;
1745
2005
return 1;
2006
}
2007
2008
+sub initialize_modified_loop_vars {
2009
+ $in_reply_to = $initial_in_reply_to;
2010
+ $references = $initial_in_reply_to || '';
2011
+ $message_num = 0;
2012
+}
2013
+
2014
+if ($validate) {
2015
+ # FIFOs can only be read once, exclude them from validation.
2016
+ my @real_files = ();
2017
+ foreach my $f (@files) {
2018
+ unless (-p $f) {
2019
+ push(@real_files, $f);
2020
+ }
2021
+ }
2022
+
2023
+ # Run the loop once again to avoid gaps in the counter due to FIFO
2024
+ # arguments provided by the user.
2025
+ my $num = 1;
2026
+ my $num_files = scalar @real_files;
2027
+ $ENV{GIT_SENDEMAIL_FILE_TOTAL} = "$num_files";
2028
+ initialize_modified_loop_vars();
2029
+ foreach my $r (@real_files) {
2030
+ $ENV{GIT_SENDEMAIL_FILE_COUNTER} = "$num";
2031
+ pre_process_file($r, 1);
2032
+ validate_patch($r, $target_xfer_encoding);
2033
+ $num += 1;
2034
+ }
2035
+ delete $ENV{GIT_SENDEMAIL_FILE_COUNTER};
2036
+ delete $ENV{GIT_SENDEMAIL_FILE_TOTAL};
2037
+}
2038
+
2039
+initialize_modified_loop_vars();
2040
foreach my $t (@files) {
2041
while (!process_file($t)) {
2042
# user edited the file