Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » JGit blobless clone: unable to fetch blobs later(Jgit checkout fails on blobless clone whereas Git command line succeeds)
JGit blobless clone: unable to fetch blobs later [message #1862837] Mon, 01 January 2024 02:48 Go to next message
Eclipse UserFriend
Unable to use JGit to do some operations on a blobless clone that I can do via Git on the command line. Specifically unable to get the blobs later. For example, consider the following sequence of Git operations on the command line:
# Clone the repository but don't checkout any blobs
git clone --no-checkout --filter=blob:none <GIT-URL> .
# Checkout a branch that is *not* the main branch on the remote
git fetch origin develop:develop
# Move to the new branch
git symbolic-ref HEAD refs/heads/develop
git checkout develop <DIRECTORY-OR-FILE>
...


I'm using the following Java code to mimic the above:
    FilterSpec filter = FilterSpec.fromFilterLine("blob:none");
    try (Git git = Git.cloneRepository()
            .setCredentialsProvider(getCredentialsProvider())
            .setDirectory(new File("/tmp/repository"))
            .setURI(<GIT-URL>)
            .setRemote(Constants.DEFAULT_REMOTE_NAME)
            .setTransportConfigCallback(t -> t.setFilterSpec(filter))
            .setNoCheckout(true)
            .call()) {
      git.fetch()
              .setCredentialsProvider(getCredentialsProvider())
              .setRemote(Constants.DEFAULT_REMOTE_NAME)
              .setRefSpecs("refs/heads/develop:refs/heads/develop")
              .call();
      git.getRepository()
              .getRefDatabase()
              .newUpdate(Constants.HEAD, false)
              .link("refs/heads/develop");
      git.checkout()
              .setName("develop")
              .addPath(<DIRECTORY-OR-FILE>)
              .call();
      ...
    }

The checkout call fails with messages like:
org.eclipse.jgit.errors.MissingObjectException: Missing unknown 57a7e7d782f72a1e846b08415c56684f8f42e5bf

The checkout also fails from the command line on the repository cloned via JGit.
Re: JGit blobless clone: unable to fetch blobs later [message #1863011 is a reply to message #1862837] Wed, 10 January 2024 16:22 Go to previous message
Eclipse UserFriend
That's not yet implemented in JGit.
Previous Topic:Git hooks in eclipse
Next Topic:http.sslcainfo config option
Goto Forum:
  


Current Time: Wed May 14 02:13:27 EDT 2025

Powered by FUDForum. Page generated in 0.03094 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top