File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ impl CredentialHelper {
257257 self . commands . push ( cmd[ 1 ..] . to_string ( ) ) ;
258258 } else if cmd. starts_with ( '/' ) || cmd. starts_with ( '\\' ) ||
259259 cmd[ 1 ..] . starts_with ( ":\\ " ) {
260- self . commands . push ( format ! ( " \" {} \" " , cmd) ) ;
260+ self . commands . push ( cmd. to_string ( ) ) ;
261261 } else {
262262 self . commands . push ( format ! ( "git credential-{}" , cmd) ) ;
263263 }
@@ -522,6 +522,26 @@ echo username=c
522522 . execute( ) . is_none( ) ) ;
523523 }
524524
525+ #[ test]
526+ fn credential_helper7 ( ) {
527+ let td = TempDir :: new ( "git2-rs" ) . unwrap ( ) ;
528+ let path = td. path ( ) . join ( "script" ) ;
529+ File :: create ( & path) . unwrap ( ) . write ( br"\
530+ #!/bin/sh
531+ echo username=$1
532+ echo password=$2
533+ " ) . unwrap ( ) ;
534+ chmod ( & path) ;
535+ let cfg = test_cfg ! {
536+ "credential.helper" => & format!( "{} a b" , path. display( ) )
537+ } ;
538+ let ( u, p) = CredentialHelper :: new ( "https://example.com/foo/bar" )
539+ . config ( & cfg)
540+ . execute ( ) . unwrap ( ) ;
541+ assert_eq ! ( u, "a" ) ;
542+ assert_eq ! ( p, "b" ) ;
543+ }
544+
525545 #[ test]
526546 fn ssh_key_from_memory ( ) {
527547 let cred = Cred :: ssh_key_from_memory (
You can’t perform that action at this time.
0 commit comments