Skip to content

Commit adbbbf4

Browse files
committed
Add test case for credential.helper containing slashes
1 parent d1ae3b6 commit adbbbf4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/cred.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -578,13 +578,13 @@ echo username=c
578578
return;
579579
} // shell scripts don't work on Windows
580580
let td = TempDir::new().unwrap();
581-
let path = td.path().join("git-credential-script");
581+
let path = td.path().join("git-credential-some-script");
582582
File::create(&path)
583583
.unwrap()
584584
.write(
585585
br"\
586586
#!/bin/sh
587-
echo username=c
587+
echo username=$1
588588
",
589589
)
590590
.unwrap();
@@ -596,14 +596,14 @@ echo username=c
596596
env::set_var("PATH", &env::join_paths(paths).unwrap());
597597

598598
let cfg = test_cfg! {
599-
"credential.https://example.com.helper" => "script",
599+
"credential.https://example.com.helper" => "some-script \"value/with\\slashes\"",
600600
"credential.helper" => "!f() { echo username=a; echo password=b; }; f"
601601
};
602602
let (u, p) = CredentialHelper::new("https://example.com/foo/bar")
603603
.config(&cfg)
604604
.execute()
605605
.unwrap();
606-
assert_eq!(u, "c");
606+
assert_eq!(u, "value/with\\slashes");
607607
assert_eq!(p, "b");
608608
}
609609

0 commit comments

Comments
 (0)