@@ -31,7 +31,7 @@ use lib::core::rewrite::{
3131} ;
3232use lib:: git:: {
3333 process_diff_for_record, update_index, CategorizedReferenceName , FileMode , GitRunInfo ,
34- MaybeZeroOid , NonZeroOid , Repo , ResolvedReferenceInfo , Stage , UpdateIndexCommand ,
34+ MaybeZeroOid , NonZeroOid , Repo , ResolvedReferenceInfo , SignOption , Stage , UpdateIndexCommand ,
3535 WorkingCopyChangesType , WorkingCopySnapshot ,
3636} ;
3737use lib:: try_exit_code;
@@ -53,6 +53,7 @@ pub fn command_main(ctx: CommandContext, args: RecordArgs) -> EyreExitOr<()> {
5353 create,
5454 detach,
5555 insert,
56+ sign_options,
5657 } = args;
5758 record (
5859 & effects,
@@ -62,6 +63,7 @@ pub fn command_main(ctx: CommandContext, args: RecordArgs) -> EyreExitOr<()> {
6263 create,
6364 detach,
6465 insert,
66+ & sign_options. into ( ) ,
6567 )
6668}
6769
@@ -74,6 +76,7 @@ fn record(
7476 branch_name : Option < String > ,
7577 detach : bool ,
7678 insert : bool ,
79+ sign_option : & SignOption ,
7780) -> EyreExitOr < ( ) > {
7881 let now = SystemTime :: now ( ) ;
7982 let repo = Repo :: from_dir ( & git_run_info. working_directory ) ?;
@@ -147,19 +150,22 @@ fn record(
147150 & snapshot,
148151 event_tx_id,
149152 message. as_deref( ) ,
153+ sign_option,
150154 ) ?) ;
151155 }
152156 } else {
153- let args = {
154- let mut args = vec ! [ "commit" ] ;
155- if let Some ( message) = & message {
156- args. extend ( [ "--message" , message] ) ;
157- }
158- if working_copy_changes_type == WorkingCopyChangesType :: Unstaged {
159- args. push ( "--all" ) ;
160- }
161- args
162- } ;
157+ let mut args = vec ! [ "commit" ] ;
158+ if let Some ( message) = & message {
159+ args. extend ( [ "--message" , message] ) ;
160+ }
161+ if working_copy_changes_type == WorkingCopyChangesType :: Unstaged {
162+ args. push ( "--all" ) ;
163+ }
164+ let sign_flag = sign_option. as_git_flag ( ) ;
165+ if let Some ( flag) = & sign_flag {
166+ args. push ( flag) ;
167+ }
168+
163169 try_exit_code ! ( git_run_info. run_direct_no_wrapping( Some ( event_tx_id) , & args) ?) ;
164170 }
165171
@@ -224,6 +230,7 @@ fn record_interactive(
224230 snapshot : & WorkingCopySnapshot ,
225231 event_tx_id : EventTransactionId ,
226232 message : Option < & str > ,
233+ sign_option : & SignOption ,
227234) -> EyreExitOr < ( ) > {
228235 let old_tree = snapshot. commit_stage0 . get_tree ( ) ?;
229236 let new_tree = snapshot. commit_unstaged . get_tree ( ) ?;
@@ -332,13 +339,15 @@ fn record_interactive(
332339 & update_index_script,
333340 ) ?;
334341
335- let args = {
336- let mut args = vec ! [ "commit" ] ;
337- if let Some ( message) = message {
338- args. extend ( [ "--message" , message] ) ;
339- }
340- args
341- } ;
342+ let mut args = vec ! [ "commit" ] ;
343+ if let Some ( message) = message {
344+ args. extend ( [ "--message" , message] ) ;
345+ }
346+ let sign_flag = sign_option. as_git_flag ( ) ;
347+ if let Some ( flag) = & sign_flag {
348+ args. push ( flag) ;
349+ }
350+
342351 git_run_info. run_direct_no_wrapping ( Some ( event_tx_id) , & args)
343352}
344353
0 commit comments