From a4927bf4be0956be5b509031afeab913f0c8d7f6 Mon Sep 17 00:00:00 2001 From: daimond113 Date: Sat, 8 Feb 2025 00:48:42 +0100 Subject: [PATCH] fix: fix types not being re-exported Code responsible for removing the file at the destination has been removed which broke the re-exporting of types. This commit reverts that change, but also silences Windows errors when removing the file. --- CHANGELOG.md | 1 + src/linking/mod.rs | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e0eea8..e23a1a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed - Fix `self-upgrade` using the wrong path when doing a fresh download by @daimond113 +- Fix types not being re-exported by @daimond113 ## [0.6.0-rc.2] - 2025-02-07 ### Fixed diff --git a/src/linking/mod.rs b/src/linking/mod.rs index 0b7ca6c..5e9f668 100644 --- a/src/linking/mod.rs +++ b/src/linking/mod.rs @@ -34,11 +34,16 @@ async fn create_and_canonicalize>(path: P) -> std::io::Result std::io::Result<()> { let hash = store_in_cas(cas_dir, contents.as_bytes()).await?; - match fs::hard_link(cas_path(&hash, cas_dir), destination).await { - Ok(_) => Ok(()), - Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => Ok(()), - Err(e) => Err(e), - } + match fs::remove_file(&destination).await { + Ok(_) => {} + Err(e) if e.kind() == std::io::ErrorKind::NotFound => {} + // TODO: investigate why this happens and whether we can avoid it without ignoring all PermissionDenied errors + #[cfg(windows)] + Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => {} + Err(e) => return Err(e), + }; + + fs::hard_link(cas_path(&hash, cas_dir), destination).await } #[derive(Debug, Clone, Copy)]