@@ -51,6 +51,7 @@ sub usage {
5151 --bcc <str> * Email Bcc:
5252 --subject <str> * Email "Subject:"
5353 --in-reply-to <str> * Email "In-Reply-To:"
54+ --annotate * Review each patch that will be sent in an editor.
5455 --compose * Open an editor for introduction.
5556
5657 Sending:
@@ -132,7 +133,8 @@ sub format_2822_time {
132133
133134# Variables we fill in automatically, or via prompting:
134135my (@to ,@cc ,@initial_cc ,@bcclist ,@xh ,
135- $initial_reply_to ,$initial_subject ,@files ,$author ,$sender ,$smtp_authpass ,$compose ,$time );
136+ $initial_reply_to ,$initial_subject ,@files ,
137+ $author ,$sender ,$smtp_authpass ,$annotate ,$compose ,$time );
136138
137139my $envelope_sender ;
138140
@@ -155,6 +157,17 @@ sub format_2822_time {
155157my $format_patch ;
156158my $compose_filename = $repo -> repo_path() . " /.gitsendemail.msg.$$ " ;
157159
160+ # Handle interactive edition of files.
161+ my $multiedit ;
162+ my $editor = $ENV {GIT_EDITOR } || Git::config(@repo , " core.editor" ) || $ENV {VISUAL } || $ENV {EDITOR } || " vi" ;
163+ sub do_edit {
164+ if (defined ($multiedit ) && !$multiedit ) {
165+ map { system (' sh' , ' -c' , $editor .' "$@"' , $editor , $_ ); } @_ ;
166+ } else {
167+ system (' sh' , ' -c' , $editor .' "$@"' , $editor , @_ );
168+ }
169+ }
170+
158171# Variables with corresponding config settings
159172my ($thread , $chain_reply_to , $suppress_from , $signed_off_by_cc , $cc_cmd );
160173my ($smtp_server , $smtp_server_port , $smtp_authuser , $smtp_encryption );
@@ -184,6 +197,7 @@ sub format_2822_time {
184197 " aliasesfile" => \@alias_files ,
185198 " suppresscc" => \@suppress_cc ,
186199 " envelopesender" => \$envelope_sender ,
200+ " multiedit" => \$multiedit ,
187201);
188202
189203# Handle Uncouth Termination
@@ -226,6 +240,7 @@ sub signal_handler {
226240 " smtp-ssl" => sub { $smtp_encryption = ' ssl' },
227241 " smtp-encryption=s" => \$smtp_encryption ,
228242 " identity=s" => \$identity ,
243+ " annotate" => \$annotate ,
229244 " compose" => \$compose ,
230245 " quiet" => \$quiet ,
231246 " cc-cmd=s" => \$cc_cmd ,
@@ -532,7 +547,12 @@ sub expand_aliases {
532547 close (C);
533548
534549 my $editor = $ENV {GIT_EDITOR } || Git::config(@repo , " core.editor" ) || $ENV {VISUAL } || $ENV {EDITOR } || " vi" ;
535- system (' sh' , ' -c' , $editor .' "$@"' , $editor , $compose_filename );
550+
551+ if ($annotate ) {
552+ do_edit($compose_filename , @files );
553+ } else {
554+ do_edit($compose_filename );
555+ }
536556
537557 open (C2," >" ,$compose_filename . " .final" )
538558 or die " Failed to open $compose_filename .final : " . $! ;
@@ -581,6 +601,8 @@ sub expand_aliases {
581601 }
582602
583603 @files = ($compose_filename . " .final" , @files );
604+ } elsif ($annotate ) {
605+ do_edit(@files );
584606}
585607
586608# Variables we set as part of the loop over files
0 commit comments