Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 12, 2025

Migrates gix-archive from the zip crate to rawzip for ZIP archive creation.

Changes

  • Dependencies: Replaced zip = "6.0.0" with rawzip = "0.4.2" and added flate2 to zip feature (required for deflate compression)

  • Archive writing (write.rs):

    • Use rawzip::ZipArchiveWriter with explicit flate2::DeflateEncoder for compression
    • Simplify timestamp handling: UtcDateTime::from_unix(seconds) instead of manual date/time component conversion
    • Ensure directory paths end with / (rawzip requirement)
  • Tests (archive.rs):

    • Update to rawzip's reading API: ZipArchive::from_slice(), mode().is_symlink(), mode().value(), get_entry().data()
    • Adjust size expectations (rawzip produces ~7% larger archives than zip crate)

API differences

// Old (zip crate)
ar.start_file(path, options)?;
ar.add_directory(path, options)?;

// New (rawzip)
let (mut entry, config) = ar.new_file(path).start()?;
let encoder = flate2::write::DeflateEncoder::new(&mut entry, compression);
let mut writer = config.wrap(encoder);
// ... write data ...

ar.new_dir(&format!("{}/", path)).create()?;  // Must end with '/'

All existing tests pass. The zip crate and its transitive dependencies (arbitrary, derive_arbitrary) are removed from the dependency tree.

Original prompt

Replace the zip crate in gix-archive with https://github.com/nickbabcock/rawzip.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Replace zip crate in gix-archive with rawzip Replace zip crate with rawzip in gix-archive Dec 12, 2025
Copilot AI requested a review from Byron December 12, 2025 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants