Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gix-archive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ gix-path = { version = "^0.10.22", path = "../gix-path", optional = true }
gix-date = { version = "^0.11.0", path = "../gix-date" }

flate2 = { version = "1.1.1", optional = true, default-features = false, features = ["zlib-rs"] }
zip = { version = "6.0.0", optional = true, default-features = false, features = ["deflate-flate2"] }
zip = { version = "6.0.0", optional = true, default-features = false, features = ["deflate-flate2-zlib-rs"] }
jiff = { version = "0.2.15", default-features = false, features = ["std"] }

thiserror = "2.0.17"
Expand Down
23 changes: 13 additions & 10 deletions gix-archive/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,20 @@ where

impl<W: std::io::Write> State<W> {
pub fn new(format: Format, mtime: gix_date::SecondsSinceUnixEpoch, out: W) -> Result<Self, Error> {
Ok(match format {
match format {
Format::InternalTransientNonPersistable => unreachable!("handled earlier"),
Format::Zip { .. } => return Err(Error::ZipWithoutSeek),
#[cfg(feature = "tar")]
Format::Zip { .. } => Err(Error::ZipWithoutSeek),
Format::Tar => {
#[cfg(feature = "tar")]
{
State::Tar((
Ok(State::Tar((
{
let mut ar = tar::Builder::new(out);
ar.mode(tar::HeaderMode::Deterministic);
ar
},
Vec::with_capacity(64 * 1024),
))
)))
}
#[cfg(not(feature = "tar"))]
{
Expand All @@ -58,7 +57,7 @@ where
Format::TarGz { compression_level } => {
#[cfg(feature = "tar_gz")]
{
State::TarGz((
Ok(State::TarGz((
{
let gz = flate2::GzBuilder::new().mtime(mtime as u32).write(
out,
Expand All @@ -72,14 +71,18 @@ where
ar
},
Vec::with_capacity(64 * 1024),
))
)))
}
#[cfg(not(feature = "tar_gz"))]
{
Err(Error::SupportNotCompiledIn { wanted: Format::TarGz })
Err(Error::SupportNotCompiledIn {
wanted: Format::TarGz {
compression_level: None,
},
})
}
}
})
}
}
}

Expand Down Expand Up @@ -244,7 +247,7 @@ fn tar_entry_type(mode: gix_object::tree::EntryMode) -> tar::EntryType {
}
}

#[cfg(any(feature = "tar", feature = "tar_gz"))]
#[cfg(any(feature = "tar", feature = "tar_gz", feature = "zip"))]
fn add_prefix<'a>(relative_path: &'a bstr::BStr, prefix: Option<&bstr::BString>) -> std::borrow::Cow<'a, bstr::BStr> {
use std::borrow::Cow;
match prefix {
Expand Down
6 changes: 3 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ unit-tests:
cargo nextest run -p gix-testtools --no-fail-fast
cargo nextest run -p gix-testtools --features xz --no-fail-fast
cargo nextest run -p gix-archive --no-default-features --no-fail-fast
cargo nextest run -p gix-archive --features tar --no-fail-fast
cargo nextest run -p gix-archive --features tar_gz --no-fail-fast
cargo nextest run -p gix-archive --features zip --no-fail-fast
cargo nextest run -p gix-archive --no-default-features --features tar --no-fail-fast
cargo nextest run -p gix-archive --no-default-features --features tar_gz --no-fail-fast
cargo nextest run -p gix-archive --no-default-features --features zip --no-fail-fast
cargo nextest run -p gix-status-tests --features gix-features-parallel --no-fail-fast
cargo nextest run -p gix-worktree-state-tests --features gix-features-parallel --no-fail-fast
cargo nextest run -p gix-worktree-tests --features gix-features-parallel --no-fail-fast
Expand Down
Loading