Skip to content

Commit de05cc0

Browse files
committed
added trimming of whitespace to credhelper
1 parent eb74d27 commit de05cc0

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

src/credhelper.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
11
use std::collections::HashMap;
2+
use std::io;
23
use std::process::{Child, Command, Stdio};
3-
use std::{fmt, io};
44

55
use log::debug;
66

77
use crate::{paramparsing, Operation};
88

9-
#[derive(Debug, Clone)]
10-
struct InvalidHelper;
11-
12-
impl fmt::Display for InvalidHelper {
13-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
14-
write!(f, "Invalid credential helper name")
15-
}
16-
}
17-
impl std::error::Error for InvalidHelper {}
18-
199
fn spawn_helper(helper: &str, operation: Operation) -> io::Result<Child> {
20-
let helpercmd = helper.trim_matches('\'');
10+
let helpercmd = helper.trim();
2111
let helpercmd = if helpercmd.starts_with('/') {
22-
String::from(helper)
12+
String::from(helpercmd)
2313
} else {
24-
format!("git credential-{}", helper)
14+
format!("git credential-{}", helpercmd)
2515
};
2616

2717
debug!("Running credential helper '{}'", helpercmd);

0 commit comments

Comments
 (0)