Skip to content

chore: fix incorrect behaviour for dir only pattern on .gitignore - #10870

Closed
TomChv wants to merge 3 commits into
dagger:mainfrom
TomChv:fix/gitignore-dir-pattern
Closed

TomChv wants to merge 3 commits into
dagger:mainfrom
TomChv:fix/gitignore-dir-pattern

Conversation

@TomChv

@TomChv TomChv commented Aug 13, 2025

Copy link
Copy Markdown
Member

Fixes #10868

@TomChv
TomChv requested a review from jedevc August 13, 2025 17:21
@TomChv TomChv self-assigned this Aug 13, 2025
@TomChv
TomChv force-pushed the fix/gitignore-dir-pattern branch from 3d261c9 to a9b862d Compare August 14, 2025 11:22
Comment thread core/util.go
// (see https://github.com/dagger/dagger/issues/10868).
// Example: !foo becomes foo then **/foo then !**/foo
// Example: foo/ becomes **/foo/
// Example: foo*/ becomes **/foo*/**

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.

What about !foo*/?

Comment thread core/util_test.go
gitIgnoreContent, ".",
)

require.Equal(t, []string{"**/foo/", "!**/build*/**", "node_modules/"}, patterns)

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.

Can we actually evaluate these patterns against an example directory in the tests?

Maybe by using mobypatternmatcher directly?

@jedevc

jedevc commented Aug 15, 2025

Copy link
Copy Markdown
Contributor

This isn't quite right.

A gitignore that has foo*/ and a dockerignore that has foo*/** isn't equivalent.

For the git case, the foo/ directory itself is excluded, while the dockerignore pattern includes it (and it's just empty).

@jedevc jedevc assigned jedevc and unassigned TomChv Aug 15, 2025
@jedevc

jedevc commented Aug 15, 2025

Copy link
Copy Markdown
Contributor

Tom's on holiday, so gonna pick this up, since we need to resolve this before he gets back.

@TomChv

TomChv commented Aug 25, 2025

Copy link
Copy Markdown
Member Author

Closing in favor of #10883

@TomChv TomChv closed this Aug 25, 2025
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.

🐞 Dagger's gitignore parser does not respect tailing slash

2 participants