scikit-build/scikit-build-core

Nested .gitignore files are ignored when building sdist

bindreams opened this issue · 6 comments

Nested .gitignore files, i.e. the ones not at the root of the project, are ignored when building sdist.

With a project structure:

dir1
  ├ file3
  ├ file4
  └ .gitignore  # file3
file1
file2
.gitignore  # file1
pyproject.toml

When building a sdist using python -m build --sdist, the top-level .gitignore is respected and file1 is not included. But the nested .gitignore inside the directory is ignored completely and both files in that dir are included.

For convenience I created a sample repo that reproduces the issue: https://github.com/bindreams/scikit-gitignore-issue

You didn't need to make a repo, I know that's the way it works currently. :) What I think would make sense would be to either make the default **/.gitignore, or .gitignore and make /.gitignore mean the top one only (that's probably easier), then recurse the tree. I'd be happy to review a PR, and I'll try to get to it in the near future otherwise.