Skip to content

Commit

Permalink
fix: check reflink support before linking (#979)
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra authored Dec 12, 2024
1 parent 60dc483 commit d8c8fca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ plist = "1"
purl = { version = "0.1.3", features = ["serde"] }
quote = "1.0.37"
rand = "0.8.5"
reflink-copy = "0.1.19"
reflink-copy = "0.1.20"
regex = "1.11.1"
reqwest = { version = "0.12.9", default-features = false }
reqwest-middleware = "0.4.0"
Expand Down
11 changes: 9 additions & 2 deletions crates/rattler/src/install/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,16 @@ pub async fn link_package(
match options.allow_hard_links {
Some(value) => ready(value).left_future(),
None => can_create_hardlinks(target_dir, package_dir).right_future(),
}
},
);
let allow_ref_links = options.allow_ref_links.unwrap_or(allow_hard_links);
let allow_ref_links = options.allow_ref_links.unwrap_or_else(|| {
match reflink_copy::check_reflink_support(package_dir, target_dir) {
Ok(reflink_copy::ReflinkSupport::Supported) => true,
Ok(reflink_copy::ReflinkSupport::NotSupported) => false,
Ok(reflink_copy::ReflinkSupport::Unknown) => allow_hard_links,
Err(_) => false,
}
});

// Determine the platform to use
let platform = options.platform.unwrap_or(Platform::current());
Expand Down

0 comments on commit d8c8fca

Please sign in to comment.