4

I am trying to update submodules:

git.submoduleUpdate().call()

but I get:

org.eclipse.jgit.api.errors.JGitInternalException: Missing unknown e88da827bdc5c5a4b0d87b8be79b81567759411b
    at org.eclipse.jgit.api.SubmoduleUpdateCommand.call(SubmoduleUpdateCommand.java:211)
    at kontinuum.WorkPackageProcessorKt.processWorkPackages(WorkPackageProcessor.kt:43)
    at kontinuum.MainKt.main(Main.kt:30)
Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown e88da827bdc5c5a4b0d87b8be79b81567759411b
    at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:145)
    at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:226)
    at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:859)
    at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:772)
    at org.eclipse.jgit.api.SubmoduleUpdateCommand.call(SubmoduleUpdateCommand.java:175)
    ... 2 more

Interestingly on the console it works:

kontinuum@ligi-tp ~/k/w/l/SurvivalManual> git submodule update
remote: Counting objects: 27, done.
remote: Compressing objects: 100% (27/27), done.
remote: Total 27 (delta 17), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (27/27), done.
From https://github.com/ligi/SurvivalManual.wiki
   b72e23e..e88da82  master     -> origin/master
Submodule path 'android/src/main/assets/md': checked out 'e88da827bdc5c5a4b0d87b8be79b81567759411b'
Strelok
  • 50,229
  • 9
  • 102
  • 115
ligi
  • 39,001
  • 44
  • 144
  • 244
  • As it works in native Git, I assume this is a bug in JGit. If you can describe how to put the local repository in a state so that it fails with this exception you may want to [open a bug](https://eclipse.org/jgit/support/) or inform the [JGit mailing list](https://dev.eclipse.org/mailman/listinfo/jgit-dev). – Rüdiger Herrmann Apr 04 '17 at 18:19
  • does it work after you did it with native git? To me looks like they do not fetch the missing object – max630 Apr 05 '17 at 09:11
  • 2
    There is a bug about this already: https://bugs.eclipse.org/bugs/show_bug.cgi?id=470318 – max630 Apr 05 '17 at 09:13

2 Answers2

2

As @max630 pointed out this is a jgit bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=470318

This is my workaround for now:

val walk = SubmoduleWalk.forIndex(git.repository)
while (walk.next()) {
   val submodule = walk.repository
   Git.wrap(submodule).fetch().call()
   submodule.close()
}
ligi
  • 39,001
  • 44
  • 144
  • 244
1

JGit does not fetch new objects at submodule update, unlike git. To avoid this situation, you can try to enable recursive fetch:

git config fetch.recurseSubmodules true

I don't know though if jgit implements it

max630
  • 8,762
  • 3
  • 30
  • 55