From 64b9dbad25b02f3f9f91000556229ccce13e58a6 Mon Sep 17 00:00:00 2001 From: dzu Date: Sat, 21 Feb 2026 10:31:49 +0000 Subject: [PATCH 1/2] fix: correct absolute paths handling --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index baf73f7..0654509 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,7 +32,7 @@ dependencies = [ [[package]] name = "anode-cache-common" version = "0.1.0" -source = "git+https://git.dzuchun.ing/actions/cache-common-src.git?tag=v2#0a3a59229111c6a96a2565de8a3e097c7bc2808b" +source = "git+https://git.dzuchun.ing/actions/cache-common-src.git?tag=v3#a460ddb58f8b2006a9edfd231d12882cc95bcca0" dependencies = [ "anyhow", "isahc", diff --git a/Cargo.toml b/Cargo.toml index d295da4..521380c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ tag = "v1" [dependencies.anode-cache-common] git = "https://git.dzuchun.ing/actions/cache-common-src.git" -tag = "v2" +tag = "v3" [build-dependencies.anode-build] git = "https://git.dzuchun.ing/dzu/anode.git" diff --git a/src/main.rs b/src/main.rs index d6c7f06..6cac9e6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,8 +49,11 @@ fn main() -> Result<()> { let mut archive = Builder::new(out_comp); archive.mode(HeaderMode::Complete); archive.follow_symlinks(false); - debug!(paths = ?path); - for path in path { + + let common = anode_cache_common::common_parent(&path); + debug!(common_path = ?common, paths = ?path); + + for (path, name) in path.iter().map(|p| (p, p.strip_prefix(&common).unwrap())) { let _span = info_span!("cache-entry"); let _span = _span.enter(); if !path.exists() { @@ -60,11 +63,11 @@ fn main() -> Result<()> { if path.is_dir() { debug!("Caching directory"); // we actually want to write out all the directory contents - archive.append_dir_all(&path, &path).unwrap(); + archive.append_dir_all(name, path).unwrap(); } else if path.is_file() { debug!("Caching a file"); // rest of the file types are handled by the existing inner code - archive.append_path(path).unwrap(); + archive.append_path_with_name(path, name).unwrap(); } else { warn!("Path is neither directory, nor a file and will not be cached"); } From 83dc450b51735d21322deeafc4d9b4a6adeada8d Mon Sep 17 00:00:00 2001 From: dzu Date: Sat, 21 Feb 2026 10:37:10 +0000 Subject: [PATCH 2/2] fix: use display for `common_path` --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 6cac9e6..17f0016 100644 --- a/src/main.rs +++ b/src/main.rs @@ -51,7 +51,7 @@ fn main() -> Result<()> { archive.follow_symlinks(false); let common = anode_cache_common::common_parent(&path); - debug!(common_path = ?common, paths = ?path); + debug!(common_path = %common.display(), paths = ?path); for (path, name) in path.iter().map(|p| (p, p.strip_prefix(&common).unwrap())) { let _span = info_span!("cache-entry");