title: JGit: Reading commits from a submodule
body: <p>I am trying to add submodules support to a <a href="https://github.com/centic9/JGitFS" rel="nofollow">project of mine</a>, however I seem to be unable to use JGit to read specific commits or to log, while commandline git can do this just fine, despite the detached head that the submodule is in (as far as by design of how submodules work).</p>
  
  <p>I have code like this, with "fuse-jna" being the submodule:</p>
  
  <pre><code>    FileRepositoryBuilder builder = new FileRepositoryBuilder();
      Repository repository = builder.setGitDir(new File("fuse-jna/.git"))
        .readEnvironment() // scan environment GIT_* variables
        .findGitDir() // scan up the file system tree
        .build();
  
      ObjectId lastCommitId = repository.resolve("39c1c4b78ff751b0b9e28f4fb35148a1acd6646f");
  
      Iterable&lt;RevCommit&gt; commits = new Git(repository).log().add(lastCommitId).call();
      for(RevCommit commit : commits) {
          System.out.println("Commit: " + commit.getId());
      }
  </code></pre>
  
  <p>with this I get:</p>
  
  <pre><code>org.eclipse.jgit.errors.MissingObjectException: Missing commit 39c1c4b78ff751b0b9e28f4fb35148a1acd6646f
  at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:149)
  at org.eclipse.jgit.revwalk.RevWalk.getCachedBytes(RevWalk.java:883)
  at org.eclipse.jgit.revwalk.RevCommit.parseHeaders(RevCommit.java:145)
  at org.eclipse.jgit.revwalk.RevWalk.markStart(RevWalk.java:279)
  at org.eclipse.jgit.api.LogCommand.add(LogCommand.java:330)
  at org.eclipse.jgit.api.LogCommand.add(LogCommand.java:189)
  at org.dstadler.jgitfs.util.JGitHelperTest.testGitLinkRepository(JGitHelperTest.java:638)
  </code></pre>
  
  <p>However on the commandline in the "fuse-jna" directory</p>
  
  <pre><code>git diff 39c1c4b78ff751b0b9e28f4fb35148a1acd6646f~
  </code></pre>
  
  <p>works just fine, so it is possible to do this.</p>
  
  <p>Is there some other way how to do this with JGit? Or is support for submodules not fully there yet?</p>