fix(streamer): prevent skipPath from over-matching .git prefix - #409
mohit-bhandari45 wants to merge 5 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/ok-to-test |
|
@mohit-bhandari45 Thanks for your contribution apparently there's something wrong with the release notes |
There was a problem hiding this comment.
🟡 Changes recommended
UNC path handling and test boundary assertions must be corrected before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
pkg/shp/streamer/tar.go:34
- This blank line contains trailing whitespace, so the changed file is not
gofmt-clean. Please remove it to keep the Go source formatter-compliant.
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Balanced
|
@mohit-bhandari45 may you check the Copilot comments whether they are of relevance. Also, make sure to sign your commits, otherwise we cannot accept them. https://github.com/shipwright-io/cli/pull/409/checks?check_run_id=100509499395 |
00e9d3f to
eef48b6
Compare
|
@SaschaSchwarze0 Updates are done and commits are signed. |
This fixes a bug where skipPath would unintentionally drop files that happened to share the .git prefix (such as .gitignore, .gitmodules) by ensuring it matches the exact .git directory boundary. Also normalizes cross-platform paths using filepath.ToSlash to prevent Windows path bugs. Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
6d7ba1f to
1c81106
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The nested .git filtering and invalid archive member handling must be corrected.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
pkg/shp/streamer/tar_test.go:42
- The claimed Windows/UNC behavior is not exercised here.
filepath.ToSlashuses the host OS separator, and the unit workflow runs only on Ubuntu (.github/workflows/unit.yaml:16), so this remains a no-op in CI and cannot catch regressions in Windowsfilepath.Relor separator handling. Please add Windows-specific coverage (or extract a platform-independent matcher that can be tested with Windows-style paths).
cleanName := filepath.ToSlash(name)
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Balanced
Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
|
@kaizakin what's the update here? |
|
LGTM from my side. |
|
@SaschaSchwarze0 Once you get time, have a look over this. |
|
@sayan-biswas - can you please review this |
aufi's review on PR migtools#91 said shp build upload does not send the same files as oc start-build --from-dir. I ran one directory through both on a ROSA cluster. oc sent everything except .git/. shp from main skipped five things. It dropped files listed in .gitignore and symlinks pointing outside the directory. It also dropped symlinks inside the directory, anything whose name starts with .git, and empty directories. W67 now names the first two, because Shipwright keeps those on purpose. The .git prefix and inner-symlink drops are bugs with fixes in review, shipwright-io/cli#409 and #355. Empty directories are not worth a warning. known-limitations.md lists all five with upstream links. ADR-0011 records the rule and the follow-ups, and architecture.md gets rule 18. The warning text is also shorter and plainer. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Prateek Singh Rathore <prateek.singh.rathore@gmail.com>
aufi's review on PR migtools#91 said shp build upload does not send the same files as oc start-build --from-dir. I ran one directory through both on a ROSA cluster. oc sent everything except .git/. shp from main skipped five things. It dropped files listed in .gitignore and symlinks pointing outside the directory. It also dropped symlinks inside the directory, anything whose name starts with .git, and empty directories. W67 now names the first two, because Shipwright keeps those on purpose. The .git prefix and inner-symlink drops are bugs with fixes in review, shipwright-io/cli#409 and #355. Empty directories are not worth a warning. known-limitations.md lists all five with upstream links. ADR-0011 records the rule and the follow-ups, and architecture.md gets rule 18. The warning text is also shorter and plainer. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Prateek Singh Rathore <prateek.singh.rathore@gmail.com>
aufi's review on PR migtools#91 said shp build upload does not send the same files as oc start-build --from-dir. I ran one directory through both on a ROSA cluster. oc sent everything except .git/. shp from main skipped five things. It dropped files listed in .gitignore and symlinks pointing outside the directory. It also dropped symlinks inside the directory, anything whose name starts with .git, and empty directories. W67 now names the first two, because Shipwright keeps those on purpose. The .git prefix and inner-symlink drops are bugs with fixes in review, shipwright-io/cli#409 and #355. Empty directories are not worth a warning. known-limitations.md lists all five with upstream links. ADR-0011 records the rule and the follow-ups, and architecture.md gets rule 18. The warning text is also shorter and plainer. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Prateek Singh Rathore <prateek.singh.rathore@gmail.com>
Changes
This fixes a bug where
skipPathin the streamer would unintentionally drop files that shared the.gitprefix, such as.gitignore,.gitmodules, and.gitattributes. The matcher now checks the source-relative path and only excludes a path component named.git.The relative-path comparison also preserves Windows UNC paths correctly.
Additionally, it normalizes cross-platform paths using
filepath.ToSlashprior to string matching to safeguard against path comparison bugs when the CLI is run on Windows machines.Related Issue
Fixes #408
Type of PR
/kind bug
Submitter Checklist
See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.
Release Notes