| Summary: | Cannot delete a directory after cloning a repository into it | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Technology] JGit | Reporter: | Tomasz Zarna <tomasz.zarna> | ||||||||
| Component: | JGit | Assignee: | Philipp Thun <philipp.thun> | ||||||||
| Status: | CLOSED WORKSFORME | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | caniszczyk, stefan.lay | ||||||||
| Version: | 0.11 | ||||||||||
| Target Milestone: | --- | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows XP | ||||||||||
| Whiteboard: | |||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 336227 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Tomasz Zarna
Created attachment 188677 [details]
failing tests
In JGit, we wrote a FileUtils class to help with this... FileUtils.delete(repo.getWorkTree(), FileUtils.RECURSIVE | FileUtils.RETRY); org.eclipse.jgit.util.FileUtils Try that first, if it doesn't work, then we can dig deeper. Created attachment 188693 [details]
failing test with org.eclipse.jgit.util.FileUtils
Thanks for the tip but it didn't help. I still get: "java.lang.AssertionError: Could not delete file C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\testCloneRepository3656357236185082524664761946001\.git\objects\pack\pack-5a1e97de671900849c0b7657ff9e866080544d28.pack [...]"
Created attachment 188694 [details]
mylyn/context/zip
You are creating a new Git object that has a repository associated with it. This repository is automatically opened and thus has to be closed so that file resources are released. By adding "git2.getRepository().close();" before "FileUtils.delete(...);", the repository gets closed, the pack file is released and removing the directory works. I think contributing this enhanced test case would be a good idea. |