Submodule update fails if submodule was previously deleted then reinitialized
eder-s opened this issue · comments
eder-s commented
Version
5.x 6.x
Operating System
Windows
Bug description
Original bug report:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=477642
JGit fails to update/restore a submodule for which the worktree was deleted but the gitdir under ".git/modules/subrepo" is still existing.
Steps to reproduce(copied from bugzilla):
- Create two repos, a remote repo and a submodule repo. Commit a file to the submodule repo, then add it as a submodule to the remote repo and do a commit in the remote repo.
- Clone the remote repo, then in the clone, perform a submodule init and a submodule update.
- Delete the submodule directory in the local clone, then perform a hard reset. Perform another submodule init, then another submodule update, and JGit will throw an exception.
Actual behavior
JGit throws an exception instead of updating/restoring the submodule.
Expected behavior
Updating the submodule succeeds.
Relevant log output
No response
Other information
No response
Matthias Sohn commented
Simon proposed this fix https://eclipse.gerrithub.io/c/eclipse-jgit/jgit/+/1198662