Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdist.exclude should not be overridden by .gitignore #871

Closed
alexreinking opened this issue Aug 22, 2024 · 2 comments · Fixed by #872
Closed

sdist.exclude should not be overridden by .gitignore #871

alexreinking opened this issue Aug 22, 2024 · 2 comments · Fixed by #872

Comments

@alexreinking
Copy link
Contributor

My .gitignore file uses the following trick to ignore (most) files without extensions:

*
!*.*
!*/

Unfortunately, the way that sdist.exclude is implemented is by prepending the listed rules to these. These are then overridden by the * in the file.

I believe that sdist.exclude should be implemented similarly to sdist.include; in a separate pathspec that is checked after sdist.include and which gets final say.

@alexreinking alexreinking changed the title Manual excludes should not be overridden by .gitignore sdist.exclude should not be overridden by .gitignore Aug 22, 2024
@henryiii
Copy link
Collaborator

Slightly related: #858

@henryiii
Copy link
Collaborator

I think that makes sense. Would you like to attempt it?

alexreinking added a commit to alexreinking/scikit-build-core that referenced this issue Aug 22, 2024
Previously, sdist.exclude and the built-in EXCLUDE_LINES were prepended
to the list of .gitignore rules. However, a common pattern of using *
to exclude everything and then using !-rules to list what should be
included renders this feature useless.

This commit changes the behavior of each_unignored_file to sequentially
consider the following sets of independent rules:

1. Explicit inclusions
2. Explicit exclusions
3. Global exclusions from the .gitignore files
4. The built-in exclusions
5. Nested exclusions from .gitignore

Fixes scikit-build#871
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 a pull request may close this issue.

2 participants