Community
Participate
Working Groups
I am using JGit to navigate in the Git repository of the Mantis bugtracker: https://github.com/mantisbt/mantisbt As of late, this repository has two submodules: "library/adodb" and "library/phpmailer". If I am trying to checkout to an older version (e.g. "release-1.2.11"), JGit performs the command but some additional files are still present: # library/phpmailer/.gitignore # library/phpmailer/README.md # library/phpmailer/changelog.md # library/phpmailer/language/phpmailer.lang-eo.php # library/phpmailer/language/phpmailer.lang-he.php # library/phpmailer/language/phpmailer.lang-sk.php A "git clean -f" would remove those files, but calling a CleanCommand results in this exception: Exception in thread "main" org.eclipse.jgit.api.errors.JGitInternalException: Could not delete file $DIR/mantisbt/library/adodb Why does JGit try to remove adodb?
Hi, I ran into a similar issue and it seems it is still existing in org.eclipse.jgit 4.4.1.201607150455-r package. Namely, git.clean().setCleanDirectories(true).setIgnore(false).call() throws and exception like below after a successful checkout of a branch where a submodule existed before the checkout, but it is not part of the checked out branch. org.eclipse.jgit.api.errors.JGitInternalException: Could not delete file /path/to/unrelated/submodule/directory at org.eclipse.jgit.api.CleanCommand.call(CleanCommand.java:138) : Caused by: java.io.IOException: Could not delete file /path/to/unrelated/submodule/directory at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:197) at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:125) at org.eclipse.jgit.api.CleanCommand.call(CleanCommand.java:125) ... 2 more I suppose a force(boolean) additional method in Git.clean() would be good for the reported problem. Please let me know your opinion or investigation so far if any. Thanks, A.L.