@@ -447,10 +447,48 @@ mod tests {
447
447
config. set_str ( "user.signingKey" , "/tmp/key.pub" ) ?;
448
448
}
449
449
450
+ let sign =
451
+ SignBuilder :: from_gitconfig ( & repo, & repo. config ( ) ?) ?;
452
+
453
+ assert_eq ! ( "ssh-keygen" , sign. program( ) ) ;
454
+ assert_eq ! ( "/tmp/key.pub" , sign. signing_key( ) ) ;
455
+
456
+ Ok ( ( ) )
457
+ }
458
+
459
+ #[ test]
460
+ fn test_ssh_keyliteral_config ( ) -> Result < ( ) > {
461
+ let ( _tmp_dir, repo) = repo_init_empty ( ) ?;
462
+
463
+ {
464
+ let mut config = repo. config ( ) ?;
465
+ config. set_str ( "gpg.program" , "ssh" ) ?;
466
+ config. set_str ( "user.signingKey" , "ssh-ed25519 test" ) ?;
467
+ }
468
+
450
469
let sign =
451
470
SignBuilder :: from_gitconfig ( & repo, & repo. config ( ) ?) ?;
452
471
453
472
assert_eq ! ( "ssh" , sign. program( ) ) ;
473
+ assert_eq ! ( true , PathBuf :: from( sign. signing_key( ) ) . is_file( ) ) ;
474
+
475
+ Ok ( ( ) )
476
+ }
477
+
478
+ #[ test]
479
+ fn test_ssh_external_bin_config ( ) -> Result < ( ) > {
480
+ let ( _tmp_dir, repo) = repo_init_empty ( ) ?;
481
+
482
+ {
483
+ let mut config = repo. config ( ) ?;
484
+ config. set_str ( "gpg.program" , "/opt/ssh/signer" ) ?;
485
+ config. set_str ( "user.signingKey" , "/tmp/key.pub" ) ?;
486
+ }
487
+
488
+ let sign =
489
+ SignBuilder :: from_gitconfig ( & repo, & repo. config ( ) ?) ?;
490
+
491
+ assert_eq ! ( "/opt/ssh/signer" , sign. program( ) ) ;
454
492
assert_eq ! ( "/tmp/key.pub" , sign. signing_key( ) ) ;
455
493
456
494
Ok ( ( ) )
0 commit comments