You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 387ad8c
Browse filesBrowse the repository at this point in the historyBrowse files
docs(repo): demonstrate closing repositories before deletion (#2101)
Reading `repo.head.commit` can open persistent object readers or retain a
native repository handle. Deleting the repository while its handles remain
open is not a supported sequence on Windows. Git's read-only object files
can independently prevent plain `shutil.rmtree()` from removing a clone.
`Repo.close()` and its context-manager support already release the retained
handle and terminate persistent Git readers synchronously. Document that
contract in the API reference, tutorial and README, replacing the old advice
to invoke destructors manually. Demonstrate closing the repository first,
then using the existing strict `git.util.rmtree()` helper for read-only files.
All instances and separately opened readers must be closed by their owners.
Add a packed-repository fixture and a tutorial regression that reads HEAD
and blob data, verifies reader processes have exited and caches are released,
and removes the directory without suppressing deletion errors. The test
passes with both CLI and Gix backends on macOS with Git 2.54.0. Sphinx's
strict HTML build, Ruff and ShellCheck pass. Windows execution is left to CI;
no automatic cleanup of a still-live repository is introduced.
0 commit comments