Skip to content

fix: avoid creating OCI layouts on delete - #2378

Merged
TerryHowe merged 4 commits into
oras-project:mainfrom
TanvirTian:fix/delete-missing-oci-layout
Nov 27, 2026
Merged

TerryHowe merged 4 commits into
oras-project:mainfrom
TanvirTian:fix/delete-missing-oci-layout

Conversation

@TanvirTian

@TanvirTian TanvirTian commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
This PR fixes an issue where deleting from a missing OCI layout creates the layout.

It checks if the layout exists before deleting and adds tests for both --oci-layout and --oci-layout-path.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #2377

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.58333% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.80%. Comparing base (447dabf) to head (03d386f).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
cmd/oras/internal/option/target.go 85.29% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2378      +/-   ##
==========================================
+ Coverage   90.74%   90.80%   +0.05%     
==========================================
  Files         157      157              
  Lines        6979     7153     +174     
==========================================
+ Hits         6333     6495     +162     
- Misses        375      383       +8     
- Partials      271      275       +4     

☔ 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.

Comment thread cmd/oras/root/manifest/delete.go Resolved
Comment thread cmd/oras/root/blob/delete.go Resolved
Comment thread cmd/oras/internal/option/target.go Resolved
Comment thread cmd/oras/internal/option/target.go Resolved
@TanvirTian

Copy link
Copy Markdown
Contributor Author

Added the requested validation and updated the tests. All affected tests are passing.

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@TerryHowe
TerryHowe merged commit c2034f0 into oras-project:main Nov 27, 2026
10 checks passed
@TerryHowe

Copy link
Copy Markdown
Member

Thanks!

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.

Deleting from a nonexistent OCI layout creates the layout

2 participants