Fix project.toml directory exclusion behavior#2404
Open
jjbustamante wants to merge 4 commits intomainfrom
Open
Fix project.toml directory exclusion behavior#2404jjbustamante wants to merge 4 commits intomainfrom
jjbustamante wants to merge 4 commits intomainfrom
Conversation
cdbb47c to
0d61b4c
Compare
This change fixes unexpected behavior when excluding directories with trailing slash patterns in project.toml. Previously, patterns like "foo/" would exclude files within the directory but still create empty directory entries in the final image. Changes: - Enhanced getFileFilter() to properly exclude directories when patterns end with "/" - Modified WriteDirToTar() to skip entire directory trees using filepath.SkipDir - Fixed isNil() function in testhelpers to properly handle nil function pointers - Added comprehensive tests for directory exclusion scenarios The fix ensures that when users specify exclude = ["foo/"] in project.toml, the directory "foo" and all its contents are completely excluded from the build process, eliminating the unexpected empty directory artifacts. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
The previous fix was too broad and broke other tests that expected different nil behavior for interfaces, channels, maps, and slices. This change restricts the fix to only handle the specific case of nil function pointers while maintaining compatibility with existing tests. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
- Enhanced getFileFilter to include parent directories when files within them match include patterns - Fixed compile error in acceptance test framework fmt.Sprint -> fmt.Sprintf - Added comprehensive test for parent directory inclusion behavior - Ensures directories like 'media' are included when 'media/mountain.jpg' is in include patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
c62871e to
9862d50
Compare
edmorley
reviewed
Jun 28, 2025
| @@ -0,0 +1,153 @@ | |||
| # CLAUDE.md | |||
Contributor
There was a problem hiding this comment.
Hi! Could you move the unrelated changes to a separate PR? :-)
Member
Author
|
I want to release |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes unexpected behavior when excluding directories with trailing slash patterns in
project.toml. Previously, patterns like"foo/"would exclude files within the directory but still create empty directory entries in the final image. This change ensures that when users specifyexclude = ["foo/"], the directoryfooand all its contents are completely excluded from the build process.Output
Before
When using
project.tomlwith:The build would show:
The empty
foo/directory was still present during build and in the final image.After
With the same
project.tomlconfiguration, the build now shows:The
foo/directory is completely excluded, with no empty directory artifacts.Documentation
Related
Resolves #2402