Skip to content

feat: Add support for per-file comments#543

Merged
Pr0methean merged 16 commits intozip-rs:masterfrom
gmlewis:gmlewis-master
Jan 28, 2026
Merged

feat: Add support for per-file comments#543
Pr0methean merged 16 commits intozip-rs:masterfrom
gmlewis:gmlewis-master

Conversation

@gmlewis
Copy link
Copy Markdown
Contributor

@gmlewis gmlewis commented Jan 22, 2026

Note that the changes in:

  • benches/read_metadata.rs
  • src/read.rs

were made to make cargo clippy happy.

Fixes: #542.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @gmlewis, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant enhancement by enabling the inclusion of per-file comments within ZIP archives. This feature provides a more granular way to attach descriptive metadata to individual entries, improving the overall utility and information richness of generated ZIP files. The changes involve extending the ZipWriter API and updating internal data structures to support this new capability, along with minor code quality improvements.

Highlights

  • New Feature: Per-File Comments: Introduced the ability to add comments to individual files within a ZIP archive, enhancing metadata capabilities.
  • API Additions: Added new public methods start_file_with_comment and start_file_from_path_with_comment to ZipWriter for creating files with associated comments.
  • Internal Logic Updates: Modified the internal start_entry function to accept an optional file comment and updated ZipFileData::is_ascii to consider the file comment.
  • Clippy Fixes and Lifetime Adjustments: Applied changes to benches/read_metadata.rs and src/read.rs to satisfy cargo clippy warnings and refined lifetime parameters in make_reader.
  • New Test Coverage: Added a new test case write_file_comment_roundtrip to ensure the correct functionality of writing and reading per-file comments.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gmlewis gmlewis changed the title feat: Add support for per-file comments (#1) feat: Add support for per-file comments Jan 22, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request successfully introduces support for per-file comments, which is a valuable addition. The implementation correctly handles comment storage, length validation, and UTF-8 flagging. The new start_file_with_comment and start_file_from_path_with_comment methods provide a clear API for this feature, and the accompanying test case ensures its functionality. The lifetime adjustments in src/read.rs and the is_ascii update in src/types.rs are also good improvements.

Copy link
Copy Markdown
Member

@Pr0methean Pr0methean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the implementation of this PR, but the API needs a rework.

@Pr0methean Pr0methean added this to the 7.3.0 milestone Jan 22, 2026
@gmlewis
Copy link
Copy Markdown
Contributor Author

gmlewis commented Jan 23, 2026

Thank you, @Pr0methean and @Its-Just-Nans!
I believe I've addressed your feedback.
Please take another look when you get a chance.

Copy link
Copy Markdown
Member

@Pr0methean Pr0methean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks; just one nitpick.

Copy link
Copy Markdown
Member

@Pr0methean Pr0methean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing clone() to to_owned() won't help; see my inline comment.

Pr0methean
Pr0methean previously approved these changes Jan 24, 2026
@Pr0methean Pr0methean dismissed Its-Just-Nans’s stale review January 24, 2026 03:22

Review consisted of 1 suggestion that was applied.

@Pr0methean Pr0methean enabled auto-merge January 24, 2026 03:22
gmlewis and others added 11 commits January 25, 2026 12:42
Co-authored-by: n4n5 <git@n4n5.dev>
Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
…d in some configurations

Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
@Pr0methean Pr0methean added this pull request to the merge queue Jan 28, 2026
Merged via the queue into zip-rs:master with commit 4f95817 Jan 28, 2026
126 checks passed
@Pr0methean Pr0methean mentioned this pull request Jan 28, 2026
@gmlewis gmlewis deleted the gmlewis-master branch January 28, 2026 14:12
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.

Support ability to create per-file comments

3 participants