Skip to content

Commit 1983fbc

Browse files
committed
Make tests more robust; fix windows tests (#450)
1 parent 8c686e0 commit 1983fbc

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

Diff for: git-repository/src/config/snapshot/credential_helpers.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod error {
1717
},
1818
}
1919
}
20-
use crate::bstr::ByteVec;
20+
use crate::bstr::{ByteSlice, ByteVec};
2121
pub use error::Error;
2222

2323
impl Snapshot<'_> {
@@ -45,14 +45,17 @@ impl Snapshot<'_> {
4545
match section.header().subsection_name() {
4646
Some(_) => {}
4747
None => {
48-
for value in section.values("helper") {
48+
for value in section.values("helper").into_iter().filter(|v| !v.trim().is_empty()) {
4949
programs.push(git_credentials::Program::from_custom_definition(value.into_owned()));
5050
}
5151
if let Some(Some(user)) = (!url_had_user_initially).then(|| {
52-
section.value("username").and_then(|n| {
53-
let n: Vec<_> = Cow::into_owned(n).into();
54-
n.into_string().ok()
55-
})
52+
section
53+
.value("username")
54+
.filter(|n| !n.trim().is_empty())
55+
.and_then(|n| {
56+
let n: Vec<_> = Cow::into_owned(n).into();
57+
n.into_string().ok()
58+
})
5659
}) {
5760
url.set_user(Some(user));
5861
}

Diff for: git-repository/tests/fixtures/make_remote_repos.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ git clone --shared base credential-helpers
199199
} >> baseline.git
200200
}
201201

202-
git config credential.helper ''
203-
git config credential.helper global
202+
git config credential.helper ""
203+
git config --add credential.helper global
204204
git config credential.https://example.com:8080.helper example-with-port
205205
git config credential.https://example.com:8080/path.helper example-with-port-and-path
206206
git config credential.https://example.com:8080/path.usehttppath 1

Diff for: tests/tools/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ fn scripted_fixture_repo_read_only_with_args_inner(
317317
.stderr(std::process::Stdio::piped())
318318
.current_dir(&script_result_directory)
319319
.env_remove("GIT_DIR")
320+
.env_remove("GIT_ASKPASS")
321+
.env_remove("SSH_ASKPASS")
322+
.env("GIT_TERMINAL_PROMPT", "false")
320323
.env("GIT_AUTHOR_DATE", "2000-01-01 00:00:00 +0000")
321324
.env("GIT_AUTHOR_EMAIL", "author@example.com")
322325
.env("GIT_AUTHOR_NAME", "author")

0 commit comments

Comments
 (0)