Skip to content

Fix TarFactory.cs formatting to unblock CI - #1404

Merged
adamhathcock merged 2 commits into
masterfrom
copilot/fix-nuget-release-job
Aug 4, 2026
Merged

Fix TarFactory.cs formatting to unblock CI#1404
adamhathcock merged 2 commits into
masterfrom
copilot/fix-nuget-release-job

Conversation

Copilot AI commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

The NuGet Release / build-and-publish CI job was failing because CreateNestedRecordingStream and its closing brace were not indented within the class body, causing dotnet csharpier check to exit with code 1.

Changes

  • TarFactory.cs: Added two new private helper methods (from PR Tar: Fix memory leak regression #1403) with correct CSharpier-compliant indentation:
    • IsGenuinelySeekable(Stream) — unwraps nested SharpCompressStream layers to check whether the underlying stream genuinely supports Seek
    • CreateNestedRecordingStream(Stream) — returns a SeekableSharpCompressStream for seekable streams (no ring buffer allocation) or a ring-buffered SharpCompressStream for non-seekable streams
  • OpenReader: switched from new SharpCompressStream(stream) to CreateNestedRecordingStream(stream), and added sharpCompressStream.Rewind() before StopRecording() so the reader position is reset before handing the stream to TarReader

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job for NuGet Release Fix TarFactory.cs formatting to unblock CI Aug 4, 2026
Copilot AI requested a review from adamhathcock August 4, 2026 07:22
@adamhathcock
adamhathcock marked this pull request as ready for review August 4, 2026 07:23
Copilot AI lite review requested due to automatic review settings August 4, 2026 07:23
@adamhathcock
adamhathcock enabled auto-merge August 4, 2026 07:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes TarFactory.OpenReader to avoid allocating a large rewind ring buffer when the real underlying stream is already seekable, while also ensuring the stream position is rewound before ending the recording scope so TarReader always starts from the correct position. This aligns OpenReader with the already-correct rewind behavior in OpenAsyncReader and unblocks CI formatting checks.

Changes:

  • Added IsGenuinelySeekable(Stream) to unwrap nested SharpCompressStream layers before checking true underlying CanSeek.
  • Added CreateNestedRecordingStream(Stream) to use SeekableSharpCompressStream for genuinely seekable streams (avoids ring-buffer allocation), otherwise fall back to a ring-buffered SharpCompressStream.
  • Updated OpenReader to use the helper and to Rewind() before StopRecording() when a wrapper match succeeds.

@adamhathcock
adamhathcock merged commit e00be8f into master Aug 4, 2026
7 checks passed
@adamhathcock
adamhathcock deleted the copilot/fix-nuget-release-job branch August 4, 2026 07:28
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.

3 participants