-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add TarEntryFormat parameter to TarFile.CreateFromDirectory methods #123427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-formats-tar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds new overloads to TarFile.CreateFromDirectory and TarFile.CreateFromDirectoryAsync methods that accept a TarEntryFormat parameter, allowing users to specify the tar archive format (V7, Ustar, Pax, or Gnu) when creating archives from directories. Previously, these methods always used the Pax format by default.
Changes:
- Added four new public API overloads with
TarEntryFormatparameter - Modified existing overloads to delegate to new overloads with
TarEntryFormat.Paxas default - Added
ValidateTarEntryFormathelper method to validate format parameter - Added comprehensive test coverage for the new overloads
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Formats.Tar/ref/System.Formats.Tar.cs | Added four new public API signatures for CreateFromDirectory and CreateFromDirectoryAsync with TarEntryFormat parameter |
| src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarFile.cs | Implemented new overloads, added format validation, updated internal methods to accept format parameter, modified existing methods to delegate with Pax default |
| src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectory.Stream.Tests.cs | Added tests for invalid format validation and format-specific archive creation |
| src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectory.File.Tests.cs | Added tests for invalid format validation and format-specific archive creation |
| src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectoryAsync.Stream.Tests.cs | Added async tests for invalid format validation and format-specific archive creation |
| src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectoryAsync.File.Tests.cs | Added async tests for invalid format validation and format-specific archive creation |
src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarFile.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarFile.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
alinpahontu2912
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
| throw new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, sourceDirectoryName)); | ||
| } | ||
|
|
||
| ValidateTarEntryFormat(format); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this validation necessary, or will it be handled implicitly by the underlying TarWriter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, TarWriter already validates the format, I added so it fails early. But yes, it is redundant
|
Closing since it's a duplicate of #123407 |
This PR adds new overloads to
TarFile.CreateFromDirectoryandTarFile.CreateFromDirectoryAsyncthat accept aTarEntryFormatparameter, allowing users to specify the tar archive format when creating archives from directories. Currently,TarFile.CreateFromDirectoryalways creates archives usingTarEntryFormat.Pax.API Changes
Implements #121819