Skip to content

Commit

Permalink
fix: don't show use override warning if symlink file
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Sep 28, 2024
1 parent 1e840b8 commit face79b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion .mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ THIS_PROJECT = "{{config_root}}-{{cwd}}"

[tools]
#node = 'lts'
tiny = { version = "1", foo = "bar" }
python = { version = "latest" }
shellcheck = "0.10"
shfmt = "3"
Expand Down
2 changes: 1 addition & 1 deletion src/cli/use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl Use {
for targ in &self.tool {
if let Some(tv) = ts.versions.get(&targ.backend) {
if let ToolSource::MiseToml(p) | ToolSource::ToolVersions(p) = &tv.source {
if p != global {
if !file::same_file(p, global) {
warn(targ, p);
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,11 @@ pub fn split_file_name(path: &Path) -> (String, String) {
(file_name_base.to_string(), ext.to_string())
}

pub fn same_file(a: &Path, b: &Path) -> bool {
let canonicalize = |p: &Path| p.canonicalize().unwrap_or_else(|_| p.to_path_buf());
canonicalize(a) == canonicalize(b)
}

#[cfg(test)]
mod tests {
use std::ops::Deref;
Expand Down

0 comments on commit face79b

Please sign in to comment.