Skip to content

Commit 5f1c865

Browse files
committed
fix: symlink support for zip archives
This started working with the upgradde of the `zip` crate.
1 parent cd4de83 commit 5f1c865

File tree

5 files changed

+95
-34
lines changed

5 files changed

+95
-34
lines changed

Cargo.lock

+82-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deny.toml

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ ignore = [
2525
allow = [
2626
"Apache-2.0",
2727
"BSD-3-Clause",
28+
"BSL-1.0",
2829
"MIT",
2930
"MIT-0",
3031
"ISC",

gix-archive/Cargo.toml

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ gix-path = { version = "^0.10.7", path = "../gix-path", optional = true }
3131
gix-date = { version = "^0.8.6", path = "../gix-date" }
3232

3333
flate2 = { version = "1.0.26", optional = true }
34-
zip = { version = "0.6.6", optional = true, default-features = false, features = ["deflate", "time"] }
34+
zip = { version = "1.3.1", optional = true, default-features = false, features = ["deflate", "time"] }
3535
time = { version = "0.3.23", optional = true, default-features = false, features = ["std"] }
3636

3737
thiserror = "1.0.26"
@@ -42,13 +42,13 @@ tar = { version = "0.4.38", optional = true }
4242
document-features = { version = "0.2.0", optional = true }
4343

4444
[dev-dependencies]
45-
gix-testtools = { path = "../tests/tools"}
46-
gix-odb = { path = "../gix-odb"}
47-
gix-worktree = { path = "../gix-worktree", default-features = false, features = ["attributes"]}
48-
gix-hash = { path = "../gix-hash"}
49-
gix-attributes = { path = "../gix-attributes"}
50-
gix-object = { path = "../gix-object"}
51-
gix-filter = { path = "../gix-filter"}
45+
gix-testtools = { path = "../tests/tools" }
46+
gix-odb = { path = "../gix-odb" }
47+
gix-worktree = { path = "../gix-worktree", default-features = false, features = ["attributes"] }
48+
gix-hash = { path = "../gix-hash" }
49+
gix-attributes = { path = "../gix-attributes" }
50+
gix-object = { path = "../gix-object" }
51+
gix-filter = { path = "../gix-filter" }
5252

5353
[package.metadata.docs.rs]
5454
all-features = true

gix-archive/src/write.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ where
126126
NextFn: FnMut(&mut Stream) -> Result<Option<Entry<'_>>, gix_worktree_stream::entry::Error>,
127127
{
128128
let compression_level = match opts.format {
129-
Format::Zip { compression_level } => compression_level.map(|lvl| lvl as i32),
129+
Format::Zip { compression_level } => compression_level.map(|lvl| lvl as i64),
130130
_other => return write_stream(stream, next_entry, out, opts),
131131
};
132132

@@ -161,10 +161,10 @@ fn append_zip_entry<W: std::io::Write + std::io::Seek>(
161161
mut entry: gix_worktree_stream::Entry<'_>,
162162
buf: &mut Vec<u8>,
163163
mtime: zip::DateTime,
164-
compression_level: Option<i32>,
164+
compression_level: Option<i64>,
165165
tree_prefix: Option<&bstr::BString>,
166166
) -> Result<(), Error> {
167-
let file_opts = zip::write::FileOptions::default()
167+
let file_opts = zip::write::FileOptions::<'_, ()>::default()
168168
.compression_method(zip::CompressionMethod::Deflated)
169169
.compression_level(compression_level)
170170
.large_file(entry.bytes_remaining().map_or(true, |len| len > u32::MAX as usize))

gix-archive/tests/archive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ mod from_tree {
208208
);
209209
let mut link = ar.by_name("prefix/symlink-to-a")?;
210210
assert!(!link.is_dir());
211-
assert!(link.is_file(), "no symlink differentiation");
211+
assert!(link.is_symlink(), "symlinks are supported as well");
212212
assert_eq!(
213213
link.unix_mode(),
214214
Some(if cfg!(windows) { 0o100644 } else { 0o120644 }),

0 commit comments

Comments
 (0)