@@ -171,7 +171,7 @@ enum SSHProgram {
171171
172172impl SSHProgram {
173173 pub fn new ( config : & git2:: Config ) -> Self {
174- match config. get_string ( "gpg.ssh.program" ) {
174+ match dbg ! ( config. get_string( "gpg.ssh.program" ) ) {
175175 Err ( _) => Self :: Default ,
176176 Ok ( ssh_program) => {
177177 if ssh_program. is_empty ( ) {
@@ -187,13 +187,13 @@ impl SSHProgram {
187187 config : & git2:: Config ,
188188 ) -> Result < Box < dyn Sign > , SignBuilderError > {
189189 match self {
190- SSHProgram :: Default => {
190+ Self :: Default => {
191191 let ssh_signer = ConfigAccess ( config)
192192 . signing_key ( )
193193 . and_then ( SSHSign :: new) ?;
194194 Ok ( Box :: new ( ssh_signer) )
195195 }
196- SSHProgram :: SystemBin ( exec_path) => {
196+ Self :: SystemBin ( exec_path) => {
197197 let key = ConfigAccess ( config) . signing_key ( ) ?;
198198 Ok ( Box :: new ( ExternalBinSSHSign :: new ( exec_path, key) ) )
199199 }
@@ -331,9 +331,10 @@ enum KeyPathOrLiteral {
331331
332332impl KeyPathOrLiteral {
333333 fn new ( buf : PathBuf ) -> Self {
334- match buf. is_file ( ) {
335- true => KeyPathOrLiteral :: KeyPath ( buf) ,
336- false => KeyPathOrLiteral :: Literal ( buf) ,
334+ if buf. is_file ( ) {
335+ Self :: KeyPath ( buf)
336+ } else {
337+ Self :: Literal ( buf)
337338 }
338339 }
339340}
@@ -344,8 +345,7 @@ impl Display for KeyPathOrLiteral {
344345 f : & mut std:: fmt:: Formatter < ' _ > ,
345346 ) -> std:: fmt:: Result {
346347 let buf = match self {
347- Self :: Literal ( x) => x,
348- Self :: KeyPath ( x) => x,
348+ Self :: KeyPath ( x) | Self :: Literal ( x) => x,
349349 } ;
350350 f. write_fmt ( format_args ! ( "{}" , buf. display( ) ) )
351351 }
@@ -376,7 +376,7 @@ impl ExternalBinSSHSign {
376376 #[ cfg( test) ]
377377 let signing_key = key_path. to_string ( ) ;
378378
379- ExternalBinSSHSign {
379+ Self {
380380 program_path,
381381 key_path,
382382 #[ cfg( test) ]
@@ -488,7 +488,7 @@ impl SSHSign {
488488 } )
489489 } else {
490490 Err ( SignBuilderError :: SSHSigningKey (
491- format ! ( "Currently, we only support a pair of ssh key in disk. Found {:?}" , key ) ,
491+ format ! ( "Currently, we only support a pair of ssh key in disk. Found {key :?}" ) ,
492492 ) )
493493 }
494494 }
@@ -628,15 +628,15 @@ mod tests {
628628
629629 {
630630 let mut config = repo. config ( ) ?;
631- config. set_str ( "gpg.program " , "ssh" ) ?;
631+ config. set_str ( "gpg.format " , "ssh" ) ?;
632632 config. set_str ( "user.signingKey" , "/tmp/key.pub" ) ?;
633633 config. set_str ( "gpg.ssh.program" , "/bin/cat" ) ?;
634634 }
635635
636636 let sign =
637637 SignBuilder :: from_gitconfig ( & repo, & repo. config ( ) ?) ?;
638638
639- assert_eq ! ( "/bin/ cat" , sign. program( ) ) ;
639+ assert_eq ! ( "cat" , sign. program( ) ) ;
640640 assert_eq ! ( "/tmp/key.pub" , sign. signing_key( ) ) ;
641641
642642 Ok ( ( ) )
0 commit comments