test(git): pin status.showUntrackedFiles in the tests' scratch repositories (#1091)

Five tty7-core tests and two tty7-server conformance checks failed on a
machine with a global `status.showUntrackedFiles=no`: git hid the files
they had just written. PINS (and so pin_repo_config) now carries
`status.showUntrackedFiles=normal`, the worktree tests' temp_repo pins
its repository, and the host conformance suite's git_repo sets the key
itself, since other crates run it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Adam Hitchcock
2026-10-04 16:12:16 +08:00
committed by GitHub
co-authored by Claude Opus 5.5
parent e60bf9f12c
commit b65a3e4efc
3 changed files with 12 additions and 4 deletions
+5 -2
View File
@@ -481,8 +481,9 @@ pub(crate) mod test_support {
/// have signing on globally. The two line-ending settings are here for the
/// same reason: Git for Windows ships `core.autocrlf=true` in its *system*
/// config, so a fixture built with LF and read back is a fixture whose
/// bytes depend on which machine ran the test.
pub(crate) const PINS: [&str; 10] = [
/// bytes depend on which machine ran the test. A developer's
/// `status.showUntrackedFiles=no` would hide the files a test just wrote.
pub(crate) const PINS: [&str; 12] = [
"-c",
"user.name=tty7 test",
"-c",
@@ -493,6 +494,8 @@ pub(crate) mod test_support {
"core.autocrlf=false",
"-c",
"core.eol=lf",
"-c",
"status.showUntrackedFiles=normal",
];
/// The same settings, written into `<repo>/.git/config`.
+1 -2
View File
@@ -452,8 +452,7 @@ mod tests {
fn temp_repo(name: &str) -> PathBuf {
let dir = scratch(name);
sh(&dir, &["git", "init", "-q"]);
sh(&dir, &["git", "config", "user.email", "t@t"]);
sh(&dir, &["git", "config", "user.name", "t"]);
assert!(crate::core::git::test_support::pin_repo_config(&dir));
std::fs::write(dir.join("a.txt"), "a").unwrap();
sh(&dir, &["git", "add", "."]);
sh(&dir, &["git", "commit", "-q", "-m", "init"]);
+6
View File
@@ -152,6 +152,12 @@ fn hit_names(hits: &[SearchHit]) -> Vec<&str> {
fn git_repo(h: &dyn Host, dir: &Path) -> Option<()> {
let out = h.git(dir, &["init", "--quiet"]).ok()?;
out.success().then_some(())?;
// A developer's `status.showUntrackedFiles=no` would hide the files a
// check just wrote.
let out = h
.git(dir, &["config", "status.showUntrackedFiles", "normal"])
.ok()?;
out.success().then_some(())
}