-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: bugs with
mise up
and prefix: versions
- Loading branch information
Showing
12 changed files
with
246 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,26 @@ bazelbuild_latest=$(mise latest ubi:bazelbuild/buildtools) | |
mise up --bump ubi:bazelbuild/buildtools | ||
assert "cat mise.toml" "[tools] | ||
\"ubi:bazelbuild/buildtools\" = { version = \"$bazelbuild_latest\", exe = \"buildifier\", matching = \"buildifier\" }" | ||
|
||
rm -f .tool-versions | ||
echo "tools.dummy = 'prefix:1'" >mise.toml | ||
mise uninstall dummy --all | ||
mkdir -p "$MISE_DATA_DIR/installs/dummy/1.0.0" | ||
assert "mise ls dummy" "dummy 1.0.0 (outdated) ~/workdir/mise.toml prefix:1" | ||
assert "mise up -n" "Would uninstall [email protected] | ||
Would install [email protected]" | ||
mise up | ||
assert "mise ls dummy" "dummy 1.1.0 ~/workdir/mise.toml prefix:1" | ||
assert "mise up dummy -n --bump" "Would uninstall [email protected] | ||
Would install [email protected] | ||
Would bump dummy@prefix:2 in ~/workdir/mise.toml" | ||
mise up dummy --bump | ||
assert "mise ls dummy" "dummy 2.0.0 ~/workdir/mise.toml prefix:2" | ||
echo "tools.dummy = 'prefix:1'" >mise.toml | ||
mise uninstall dummy --all | ||
mise i [email protected] | ||
assert "mise up dummy -n --bump" "Would uninstall [email protected] | ||
Would install [email protected] | ||
Would bump dummy@prefix:2 in ~/workdir/mise.toml" | ||
mise up dummy --bump | ||
assert "mise ls dummy" "dummy 2.0.0 ~/workdir/mise.toml prefix:2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,16 +235,26 @@ pub trait Backend: Debug + Send + Sync { | |
install_state::list_versions(&self.ba().short) | ||
} | ||
fn is_version_installed(&self, tv: &ToolVersion, check_symlink: bool) -> bool { | ||
let check_path = |install_path: &Path| { | ||
let is_installed = install_path.exists(); | ||
let is_not_incomplete = !self.incomplete_file_path(tv).exists(); | ||
let is_valid_symlink = !check_symlink || !is_runtime_symlink(install_path); | ||
|
||
is_installed && is_not_incomplete && is_valid_symlink | ||
}; | ||
match tv.request { | ||
ToolRequest::System { .. } => true, | ||
ToolRequest::Prefix { .. } => { | ||
// can't use tv.request.install_path() in this case since it may point to a version | ||
// that matches the prefix but is not the correct one. For example, in the following | ||
// scenario this would not upgrade tiny because "prefix:1" would still match and | ||
// `mise up` would think it is installed | ||
// mise install [email protected] | ||
// mise use tiny@prefix:1 | ||
// mise up tiny | ||
check_path(&tv.install_path()) | ||
} | ||
_ => { | ||
let check_path = |install_path: &Path| { | ||
let is_installed = install_path.exists(); | ||
let is_not_incomplete = !self.incomplete_file_path(tv).exists(); | ||
let is_valid_symlink = !check_symlink || !is_runtime_symlink(install_path); | ||
|
||
is_installed && is_not_incomplete && is_valid_symlink | ||
}; | ||
if let Some(install_path) = tv.request.install_path() { | ||
if check_path(&install_path) { | ||
return true; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.