|Re: [jgit-dev] Auto gc in background thread prevents deleting repositories|
I have a test suite that - for each test - creates a temporary repository and deletes it after the test was run. Deleting is implemented with recursively calling File::delete() for each file in the repository's directory.
After updating to JGit 4.7.1, I occasionally see repositories that cannot be deleted because deleting the file .git/gc.log.lock fails (i.e. File::delete() returns false). Note that the code correctly closes the repository before deleting the respective directory.
It seems that the auto gc code does not stop if a repository has been/is being closed and thus prevents it from being deleted properly.
I currently configure the test repositories to skip auto gc in order to work around this issue. However in use cases where auto gc is desired, accessing repositories beyond their life cycle may still have unwanted side effects.