Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion cli/tests/completion_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,12 @@ fn a_failed_install_says_what_the_system_said() {
let scratch = Scratch::new("io_cause");
// A file where a directory has to go: deterministic, and the same failure for root, which is
// who a container runs as.
let target = scratch.dir.join("data/zsh/site-functions");
//
// Joined a segment at a time. `join("data/zsh/site-functions")` keeps the slashes it was
// given, so on Windows `display()` renders `…\data/zsh/site-functions` while the error
// being matched against says `…\data\zsh\site-functions` — the same path, spelled two
// ways, and the assertion below compares spellings.
let target = scratch.dir.join("data").join("zsh").join("site-functions");
std::fs::create_dir_all(target.parent().unwrap()).unwrap();
std::fs::write(&target, "not a directory\n").unwrap();

Expand Down
12 changes: 10 additions & 2 deletions cli/tests/shell_completions_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ fn skip_if_shell_missing(shell: &str) -> bool {
if shell_can_run_a_script(shell) {
return false;
}
if env::var("CI").is_ok_and(|v| !v.is_empty()) {
// Unix only. The workflow installs zsh and fish for the Linux job alone, so a shell missing
// there is a configuration bug and refusing to skip is what catches it. Nothing installs them
// on Windows, where their absence is the expected state rather than a mistake — mise draws the
// same line, installing no POSIX shells on its Windows runners at all.
if cfg!(unix) && env::var("CI").is_ok_and(|v| !v.is_empty()) {
panic!("shell `{shell}` cannot run a script but CI is set — refusing to skip");
}
eprintln!(
Expand Down Expand Up @@ -178,7 +182,11 @@ fn bash_completion_or_skip() -> Option<PathBuf> {
if let Some(path) = system_bash_completion() {
return Some(path);
}
if env::var("CI").is_ok_and(|v| !v.is_empty()) {
// Unix only, for the same reason as `skip_if_shell_missing` and a stronger one: there is no
// bash-completion to install on Windows. Git for Windows does not ship the library, and usage
// stopped carrying its own copy in 6.0 (#1176) — so unlike a missing zsh, this is not a thing
// a runner could be configured to have.
if cfg!(unix) && env::var("CI").is_ok_and(|v| !v.is_empty()) {
panic!(
"no usable bash-completion but CI is set — refusing to skip. Tried: {:?}",
bash_completion_candidates()
Expand Down