Untrack .venv312 — and fix the ignore rule that was meant to stop it - #27
Merged
HUANGCHIHHUNGLeo merged 1 commit intoAug 31, 2026
Merged
Conversation
.venv312/ has been tracked since 2026-07-30. .gitignore gained a
`.venv*/` line for it, but two separate things kept the virtualenv in
the repository:
1. .gitignore never untracks what is already committed. It only stops
new paths from being staged, so the 5,425 files already in the index
stayed in the index.
2. That `.venv*/` line matches nothing. It carries a trailing comment,
and gitignore only treats `#` as a comment at the start of a line —
so the pattern is the entire literal string, padding spaces and
prose included. Before this change:
$ git check-ignore -v .venv312/foo # no output, exit 1
$ git check-ignore -v .venv/foo
.gitignore:6:.venv/ .venv/foo
The comment now sits on its own line, and the pattern matches:
$ git check-ignore -v .venv312/foo
.gitignore:9:.venv*/ .venv312/foo
Fixing only the first would have left .venv312/ untracked *and*
unignored — one `git add -A` away from coming straight back.
tracked files 5,586 -> 161
of those, venv 5,425 -> 0
No history is rewritten: every commit SHA is unchanged, the release
tags still point where they pointed, and open forks are unaffected. A
full clone still carries the blobs in history, so this does not reclaim
the 146 MB; it stops new checkouts from materialising a virtualenv and
stops the next `git add -A` from re-committing one.
Verified on a clean checkout, mirroring what CI does: `pip install -e .`
succeeds, `crv --help` exits 0, and pytest reports 75 passed. No tracked
file outside .gitignore referenced .venv312, and CI builds its own
environment with setup-python, so it never used the committed one.
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.
Closes #26. This is option (1) from that issue, the non-destructive one you signed off on.
While preparing it I found a second cause, which changes what the fix has to contain.
.gitignore's.venv*/rule was never activeThe line carries a trailing comment, and gitignore only treats
#as a comment when it starts a line. So the pattern is the whole literal string — padding spaces and prose included — and it matches nothing:Moving the comment onto its own line makes it match:
That is why the PR touches
.gitignoreas well as the index.git rm -r --cachedon its own would have left.venv312/untracked and unignored — onegit add -Aaway from coming straight back, which is roughly how it got committed in the first place.I kept your original note and added one line saying why it has to live above the pattern, in the same language as the rest of the file. Change it freely if you'd rather word it differently.
Effect
Nothing is rewritten. Every commit SHA is unchanged, the release tags still point where they pointed, and the 183 open forks are unaffected. A full clone still carries the blobs in history, so the 146 MB is not reclaimed — this stops new checkouts from materialising a virtualenv and stops the next
git add -Afrom re-committing one. Reclaiming the space still needs the history rewrite, which stays off the table.How I verified
On a clean checkout of this branch, mirroring what CI does:
pip install -e .succeedscrv --helpexits 0pytest -q-> 75 passedgit statusclean,.venv312/correctly ignored rather than untracked.gitignorementions.venv312, and CI builds its own environment withsetup-python, so it never used the committed oneThe diff is 5,425 deletions plus three lines of
.gitignore, so it reads best with whitespace hidden or by looking at.gitignorealone.