-
-
Notifications
You must be signed in to change notification settings - Fork 425
Closed
Description
I have the following scenario:
- Init/Clone a repo
- An exception happens
- Try to delete the repo during exception handling
- Get the following error:
The process cannot access the file because it is being used by another process: 'c:\users\testuser\1515512906fdd749\.git\objects\pack\pack-60818aaa1af2cbb2dc09737a822fed53f6ad08be.idx'
I've tried adding this to the exception handling before deleting the repo:
repo = porcelain.open_repo(repo_path)
repo.close()
which works sometimes, but not in all scenarios.
I've found that if I always just close the repo immediately after init/clone, and then just reopen it, I never run into any issues when trying to delete the repo later:
repo = porcelain.init(path) # or porcelain.clone(...)
repo.close()
repo = porcelain.open_repo(repo.path)
This should mean that one of the two is true:
- Init/Clone shouldn't be maintaining the lock on the .idx files, and this is a bug
- There are some unintended consequences to my code that I just haven't run into yet.
@jelmer Do you know which of these two is the case?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels