Skip to content

Untrack .venv312 — and fix the ignore rule that was meant to stop it - #27

Merged
HUANGCHIHHUNGLeo merged 1 commit into
HUANGCHIHHUNGLeo:masterfrom
Daily-AC:untrack-venv312
Aug 31, 2026
Merged

Untrack .venv312 — and fix the ignore rule that was meant to stop it#27
HUANGCHIHHUNGLeo merged 1 commit into
HUANGCHIHHUNGLeo:masterfrom
Daily-AC:untrack-venv312

Conversation

@Daily-AC

Copy link
Copy Markdown
Contributor

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 active

The 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:

$ git check-ignore -v .venv312/foo     # before: no output, exit 1
$ git check-ignore -v .venv/foo        # the older, unadorned rule works
.gitignore:6:.venv/     .venv/foo

Moving the comment onto its own line makes it match:

$ git check-ignore -v .venv312/foo     # after
.gitignore:9:.venv*/    .venv312/foo

That is why the PR touches .gitignore as well as the index. git rm -r --cached on its own would have left .venv312/ untracked and unignored — one git add -A away 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

tracked files    5,586 -> 161
of those, venv   5,425 -> 0

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 -A from 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 . succeeds
  • crv --help exits 0
  • pytest -q -> 75 passed
  • git status clean, .venv312/ correctly ignored rather than untracked
  • No tracked file outside .gitignore mentions .venv312, and CI builds its own environment with setup-python, so it never used the committed one

The diff is 5,425 deletions plus three lines of .gitignore, so it reads best with whitespace hidden or by looking at .gitignore alone.

.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.
@HUANGCHIHHUNGLeo
HUANGCHIHHUNGLeo merged commit 09d9316 into HUANGCHIHHUNGLeo:master Aug 31, 2026
9 checks passed
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.

The repo ships a committed .venv312 — 5,425 of 5,586 tracked files, 146 MB on a shallow clone

2 participants