Merge nucleic/tidy-thistle-egret-5vjm into dev
This commit is contained in:
@@ -57,3 +57,43 @@ fn positional_args_survive_short_flags_after_dash_c() {
|
||||
fn combined_dash_lc_still_works() {
|
||||
assert_eq!(stdout_of(&["--noprofile", "--norc", "-lc", "echo hi"]), "hi\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dot_builtin_finds_git_setup_script_on_path() {
|
||||
let scratch = std::env::temp_dir().join(format!("nash-dot-path-{}", std::process::id()));
|
||||
let path_dir = scratch.join("git-core");
|
||||
let work_dir = scratch.join("worktree");
|
||||
let _ = std::fs::remove_dir_all(&scratch);
|
||||
std::fs::create_dir_all(&path_dir).unwrap();
|
||||
std::fs::create_dir_all(&work_dir).unwrap();
|
||||
std::fs::write(
|
||||
path_dir.join("git-sh-setup"),
|
||||
"require_work_tree() { echo sourced-git-setup; }\n",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// git-subtree uses this exact shape: GIT_EXEC_PATH is prepended to PATH,
|
||||
// then the script says `. git-sh-setup` without a slash.
|
||||
let output = Command::new(env!("CARGO_BIN_EXE_nash"))
|
||||
.args([
|
||||
"--noprofile",
|
||||
"--norc",
|
||||
"-c",
|
||||
". git-sh-setup; require_work_tree",
|
||||
])
|
||||
.env("PATH", &path_dir)
|
||||
.current_dir(&work_dir)
|
||||
.output()
|
||||
.expect("spawn nash");
|
||||
|
||||
let _ = std::fs::remove_dir_all(&scratch);
|
||||
assert!(
|
||||
output.status.success(),
|
||||
"nash failed: {}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
);
|
||||
assert_eq!(
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
"sourced-git-setup\n"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user