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 {
257
257
self . commands . push ( cmd[ 1 ..] . to_string ( ) ) ;
258
258
} else if cmd. starts_with ( '/' ) || cmd. starts_with ( '\\' ) ||
259
259
cmd[ 1 ..] . starts_with ( ":\\ " ) {
260
- self . commands . push ( format ! ( " \" {} \" " , cmd) ) ;
260
+ self . commands . push ( cmd. to_string ( ) ) ;
261
261
} else {
262
262
self . commands . push ( format ! ( "git credential-{}" , cmd) ) ;
263
263
}
@@ -522,6 +522,26 @@ echo username=c
522
522
. execute( ) . is_none( ) ) ;
523
523
}
524
524
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
+
525
545
#[ test]
526
546
fn ssh_key_from_memory ( ) {
527
547
let cred = Cred :: ssh_key_from_memory (
You can’t perform that action at this time.
0 commit comments