Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/cred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl CredentialHelper {
self.commands.push(cmd[1..].to_string());
} else if cmd.starts_with('/') || cmd.starts_with('\\') ||
cmd[1..].starts_with(":\\") {
self.commands.push(format!("\"{}\"", cmd));
self.commands.push(cmd.to_string());
} else {
self.commands.push(format!("git credential-{}", cmd));
}
Expand Down Expand Up @@ -522,6 +522,26 @@ echo username=c
.execute().is_none());
}

#[test]
fn credential_helper7() {
let td = TempDir::new("git2-rs").unwrap();
let path = td.path().join("script");
File::create(&path).unwrap().write(br"\
#!/bin/sh
echo username=$1
echo password=$2
").unwrap();
chmod(&path);
let cfg = test_cfg! {
"credential.helper" => &format!("{} a b", path.display())
};
let (u, p) = CredentialHelper::new("https://example.com/foo/bar")
.config(&cfg)
.execute().unwrap();
assert_eq!(u, "a");
assert_eq!(p, "b");
}

#[test]
fn ssh_key_from_memory() {
let cred = Cred::ssh_key_from_memory(
Expand Down