Skip to content

drop redundant ExcludePatterns initialization - #62

Merged
thaJeztah merged 1 commit into
moby:mainfrom
thaJeztah:excludes_no_slice
Jul 22, 2026
Merged

drop redundant ExcludePatterns initialization#62
thaJeztah merged 1 commit into
moby:mainfrom
thaJeztah:excludes_no_slice

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

Remove the explicit initialization of nil ExcludePatterns to an empty slice.

This normalization was introduced in moby/moby commit 62d83404 ("Pass options to chroot archive untar"):

moby/moby@62d8340

The current go-archive unpack paths no longer serialize or otherwise distinguish nil and empty slices, so the initialization is redundant.

Remove the explicit initialization of nil ExcludePatterns to an empty
slice.

This normalization was introduced in moby/moby commit 62d83404
("Pass options to chroot archive untar"):

  moby/moby@62d8340

The current go-archive unpack paths no longer serialize or otherwise
distinguish nil and empty slices, so the initialization is redundant.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Copilot AI review requested due to automatic review settings July 21, 2026 19:44

Copilot AI left a comment

Copy link
Copy Markdown

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 removes redundant normalization that converted TarOptions.ExcludePatterns from nil to an empty slice ([]string{}) in several unpack-related paths. Since the current unpack logic treats nil and empty slices equivalently (e.g., range over a nil slice is safe), the explicit initialization is unnecessary.

Changes:

  • Removed ExcludePatterns nil-to-empty initialization in archive/chrootarchive unpack handlers.
  • Simplified TestChrootUntarWithHugeExcludesList to pass TarOptions via a struct literal.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
diff.go Removes redundant ExcludePatterns slice initialization in UnpackLayer.
chrootarchive/diff_unix.go Removes redundant ExcludePatterns slice initialization in applyLayerHandler.
chrootarchive/archive.go Removes redundant ExcludePatterns slice initialization in untarHandler.
chrootarchive/archive_test.go Adjusts test to construct TarOptions inline while preserving behavior.
archive.go Removes redundant ExcludePatterns slice initialization in untarHandler.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter

codecov-commenter commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.97%. Comparing base (e04f49b) to head (8bdc583).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #62      +/-   ##
==========================================
- Coverage   65.75%   63.97%   -1.78%     
==========================================
  Files          42       42              
  Lines        2038     2634     +596     
==========================================
+ Hits         1340     1685     +345     
- Misses        528      777     +249     
- Partials      170      172       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thaJeztah
thaJeztah requested a review from vvoland July 21, 2026 19:50
@thaJeztah
thaJeztah merged commit 6c64489 into moby:main Jul 22, 2026
12 checks passed
@thaJeztah
thaJeztah deleted the excludes_no_slice branch July 22, 2026 09:47
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.

4 participants