Skip to content

Commit ef3bca9

Browse files
committed
Add test case for credential.helper containing slashes
1 parent a49d8bb commit ef3bca9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: src/cred.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -584,13 +584,13 @@ echo username=c
584584
return;
585585
} // shell scripts don't work on Windows
586586
let td = TempDir::new().unwrap();
587-
let path = td.path().join("git-credential-script");
587+
let path = td.path().join("git-credential-some-script");
588588
File::create(&path)
589589
.unwrap()
590590
.write(
591591
br"\
592592
#!/bin/sh
593-
echo username=c
593+
echo username=$1
594594
",
595595
)
596596
.unwrap();
@@ -602,14 +602,14 @@ echo username=c
602602
env::set_var("PATH", &env::join_paths(paths).unwrap());
603603

604604
let cfg = test_cfg! {
605-
"credential.https://example.com.helper" => "script",
605+
"credential.https://example.com.helper" => "some-script \"value/with\\slashes\"",
606606
"credential.helper" => "!f() { echo username=a; echo password=b; }; f"
607607
};
608608
let (u, p) = CredentialHelper::new("https://example.com/foo/bar")
609609
.config(&cfg)
610610
.execute()
611611
.unwrap();
612-
assert_eq!(u, "c");
612+
assert_eq!(u, "value/with\\slashes");
613613
assert_eq!(p, "b");
614614
}
615615

0 commit comments

Comments
 (0)