Compare commits

..
Author SHA1 Message Date
dzu
b4331b9d72 Merge branch 'dev'
All checks were successful
Build and update the action / build-and-upload (push) Successful in 13m45s
2026-02-21 11:18:22 +00:00
dzu
83dc450b51 fix: use display for common_path
All checks were successful
Build and update the action / build-and-upload (push) Successful in 2m23s
2026-02-21 10:37:10 +00:00
dzu
64b9dbad25 fix: correct absolute paths handling
All checks were successful
Build and update the action / build-and-upload (push) Successful in 2m26s
2026-02-21 10:31:49 +00:00
3 changed files with 9 additions and 6 deletions

2
Cargo.lock generated
View file

@ -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",

View file

@ -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"

View file

@ -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.display(), 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");
}