@@ -440,19 +440,28 @@ mod tests {
440440 #[ test]
441441 fn test_ssh_program_configs ( ) -> Result < ( ) > {
442442 let ( _tmp_dir, repo) = repo_init_empty ( ) ?;
443+ let temp_file = tempfile:: NamedTempFile :: new ( )
444+ . expect ( "failed to create temp file" ) ;
443445
444446 {
445447 let mut config = repo. config ( ) ?;
446- config. set_str ( "gpg.program" , "ssh" ) ?;
447- config. set_str ( "user.signingKey" , "/tmp/key.pub" ) ?;
448+ config. set_str ( "gpg.format" , "ssh" ) ?;
449+ config. set_str (
450+ "user.signingKey" ,
451+ temp_file. path ( ) . to_str ( ) . unwrap ( ) ,
452+ ) ?;
448453 }
449454
450455 let sign =
451456 SignBuilder :: from_gitconfig ( & repo, & repo. config ( ) ?) ?;
452457
453458 assert_eq ! ( "ssh-keygen" , sign. program( ) ) ;
454- assert_eq ! ( "/tmp/key.pub" , sign. signing_key( ) ) ;
459+ assert_eq ! (
460+ temp_file. path( ) . to_str( ) . unwrap( ) ,
461+ sign. signing_key( )
462+ ) ;
455463
464+ drop ( temp_file) ;
456465 Ok ( ( ) )
457466 }
458467
@@ -462,14 +471,14 @@ mod tests {
462471
463472 {
464473 let mut config = repo. config ( ) ?;
465- config. set_str ( "gpg.program " , "ssh" ) ?;
474+ config. set_str ( "gpg.format " , "ssh" ) ?;
466475 config. set_str ( "user.signingKey" , "ssh-ed25519 test" ) ?;
467476 }
468477
469478 let sign =
470479 SignBuilder :: from_gitconfig ( & repo, & repo. config ( ) ?) ?;
471480
472- assert_eq ! ( "ssh" , sign. program( ) ) ;
481+ assert_eq ! ( "ssh-keygen " , sign. program( ) ) ;
473482 assert_eq ! ( true , PathBuf :: from( sign. signing_key( ) ) . is_file( ) ) ;
474483
475484 Ok ( ( ) )
@@ -478,18 +487,27 @@ mod tests {
478487 #[ test]
479488 fn test_ssh_external_bin_config ( ) -> Result < ( ) > {
480489 let ( _tmp_dir, repo) = repo_init_empty ( ) ?;
490+ let temp_file = tempfile:: NamedTempFile :: new ( )
491+ . expect ( "failed to create temp file" ) ;
481492
482493 {
483494 let mut config = repo. config ( ) ?;
484- config. set_str ( "gpg.program" , "/opt/ssh/signer" ) ?;
485- config. set_str ( "user.signingKey" , "/tmp/key.pub" ) ?;
495+ config. set_str ( "gpg.format" , "ssh" ) ?;
496+ config. set_str ( "gpg.ssh.program" , "/opt/ssh/signer" ) ?;
497+ config. set_str (
498+ "user.signingKey" ,
499+ temp_file. path ( ) . to_str ( ) . unwrap ( ) ,
500+ ) ?;
486501 }
487502
488503 let sign =
489504 SignBuilder :: from_gitconfig ( & repo, & repo. config ( ) ?) ?;
490505
491506 assert_eq ! ( "/opt/ssh/signer" , sign. program( ) ) ;
492- assert_eq ! ( "/tmp/key.pub" , sign. signing_key( ) ) ;
507+ assert_eq ! (
508+ temp_file. path( ) . to_str( ) . unwrap( ) ,
509+ sign. signing_key( )
510+ ) ;
493511
494512 Ok ( ( ) )
495513 }
0 commit comments