-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix gitignore to not ignore files that are required #7538
Conversation
I haven't looked into this deeply but I think we need most of these files? |
yes i think i have to fix the gitignore (and then figure out testing, because the files locally still exist, so the tests still pass, they are just deleted from what git tracks) |
git rm -r --cached . && git add .
.gitignore
Outdated
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personally, i'd just remove everything from gitignore we don't explicitly need. in this case, lib
would ignore part of the resolver test case (and nobody should be writing e.g. eggs anymore anyway)
Also good news, venvs created by python -m venv
will gitignore themselves from python 3.13 on: python/cpython#108125. venvs created by virtualenv
already gitignore themselves for a while already (pypa/virtualenv#1825)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally find this useful because it matches the exact GitHub-recommended .gitignore
, so it's easy to maintain and update in the future if needed.
@@ -1,3 +0,0 @@ | |||
a = 1 | |||
|
|||
__all__ = list(["a", "b"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the deal with this file? Is it just not used at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test cases create this file
ruff/crates/ruff_cli/src/cache.rs
Line 471 in 7f1456a
test_cache.write_source_file("source.py", source); |
.gitignore
Outdated
@@ -169,6 +149,7 @@ venv/ | |||
ENV/ | |||
env.bak/ | |||
venv.bak/ | |||
!crates/ruff_python_resolver/resources/test/airflow/venv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this up to the project-specific ignores at the top?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately not, the reinclusion needs to happen after the exclusion
ddfbaf7
to
b9f3740
Compare
b9f3740
to
27a5c2a
Compare
I've changed it to a minimal diff |
It is apparently possible to add files to the git index, even if they are part of the gitignore (see e.g. https://stackoverflow.com/questions/45400361/why-is-gitignore-not-ignoring-my-files, even though it's strange that the gitignore entries existed before the files were added, i wouldn't know how to get them added in that case). I ran
then change the gitignore not actually ignore those files with the exception of
crates/ruff_cli/resources/test/fixtures/cache_mutable/source.py
, which is actually a generated file.