@@ -31,7 +31,7 @@ use lib::core::rewrite::{
31
31
} ;
32
32
use lib:: git:: {
33
33
process_diff_for_record, update_index, CategorizedReferenceName , FileMode , GitRunInfo ,
34
- MaybeZeroOid , NonZeroOid , Repo , ResolvedReferenceInfo , Stage , UpdateIndexCommand ,
34
+ MaybeZeroOid , NonZeroOid , Repo , ResolvedReferenceInfo , SignOption , Stage , UpdateIndexCommand ,
35
35
WorkingCopyChangesType , WorkingCopySnapshot ,
36
36
} ;
37
37
use lib:: try_exit_code;
@@ -53,6 +53,7 @@ pub fn command_main(ctx: CommandContext, args: RecordArgs) -> EyreExitOr<()> {
53
53
create,
54
54
detach,
55
55
insert,
56
+ sign_options,
56
57
} = args;
57
58
record (
58
59
& effects,
@@ -62,6 +63,7 @@ pub fn command_main(ctx: CommandContext, args: RecordArgs) -> EyreExitOr<()> {
62
63
create,
63
64
detach,
64
65
insert,
66
+ & sign_options. into ( ) ,
65
67
)
66
68
}
67
69
@@ -74,6 +76,7 @@ fn record(
74
76
branch_name : Option < String > ,
75
77
detach : bool ,
76
78
insert : bool ,
79
+ sign_option : & SignOption ,
77
80
) -> EyreExitOr < ( ) > {
78
81
let now = SystemTime :: now ( ) ;
79
82
let repo = Repo :: from_dir ( & git_run_info. working_directory ) ?;
@@ -147,19 +150,22 @@ fn record(
147
150
& snapshot,
148
151
event_tx_id,
149
152
message. as_deref( ) ,
153
+ sign_option,
150
154
) ?) ;
151
155
}
152
156
} 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
+
163
169
try_exit_code ! ( git_run_info. run_direct_no_wrapping( Some ( event_tx_id) , & args) ?) ;
164
170
}
165
171
@@ -224,6 +230,7 @@ fn record_interactive(
224
230
snapshot : & WorkingCopySnapshot ,
225
231
event_tx_id : EventTransactionId ,
226
232
message : Option < & str > ,
233
+ sign_option : & SignOption ,
227
234
) -> EyreExitOr < ( ) > {
228
235
let old_tree = snapshot. commit_stage0 . get_tree ( ) ?;
229
236
let new_tree = snapshot. commit_unstaged . get_tree ( ) ?;
@@ -332,13 +339,15 @@ fn record_interactive(
332
339
& update_index_script,
333
340
) ?;
334
341
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
+
342
351
git_run_info. run_direct_no_wrapping ( Some ( event_tx_id) , & args)
343
352
}
344
353
0 commit comments