Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Problem checking out large files with JGIT LFS BuiltinLFS
Problem checking out large files with JGIT LFS BuiltinLFS [message #1841449] Mon, 17 May 2021 09:39
Martin R. is currently offline Martin R.Friend
Messages: 1
Registered: May 2021
Junior Member
Hi, we are using JGIT 5.10.0.202012080955-r in an Android App (API Level 29).
So far everything is working fine, but we have trouble to setup LFS.
Trying to register and setup the BuiltinLFS hooks like this:
private void cloneRepo() throws IOException, InvalidRemoteException, TransportException, GitAPIException, InterruptedException, URISyntaxException {
        BuiltinLFS.register();
        FileRepositoryBuilder builder = new FileRepositoryBuilder();
        Repository repository = builder.setWorkTree(m_gitDir).setup().build();
        Git git = new Git(repository);
        CloneCommand clone = git.cloneRepository();
        clone.setBare(false);
        clone.setCloneAllBranches(true);
        clone.setDirectory(m_gitDir).setURI(m_url);
        clone.setCredentialsProvider(m_user);
        clone.setProgressMonitor(m_progressMonitor);
        clone.call();
        InstallBuiltinLfsCommand installLfs = (InstallBuiltinLfsCommand) BuiltinLFS.getInstance().getInstallCommand();
        installLfs.setRepository(repository);
        installLfs.call();
        pullRepo();
    }

    private void pullRepo() throws IOException, InvalidRemoteException, TransportException, GitAPIException, URISyntaxException {
        Git git = Git.open(m_gitDir);
        Repository repo = git.getRepository();
        RemoteSetUrlCommand setUrl = git.remoteSetUrl();
        setUrl.setRemoteName("origin");
        setUrl.setRemoteUri(new URIish(m_url));
        setUrl.call();

        git
                .pull()
                .setCredentialsProvider(m_user)
                .setRemote("origin")
                .setRemoteBranchName("master")
                .setProgressMonitor(m_progressMonitor)
                .call();
    }

The repo is set up for LFS according the gitlab guide and it is hosted on gitlab.
However, running cloneRepo() above just checks out using the normal git process. The large files in the repo are not downloaded, no error thrown. Checking out the large files from desktop using the normal git command is working fine.
We also tried to call
InstallBuiltinLfsCommand
without
setRepository
but this fails, as
SystemReader.getInstance().getUserConfig();
in org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/InstallBuiltinLfsCommand.java returns null.
Any help appreciated how to setup LFS for JGIT. Is there some equivalent API functions to the normal
git lfs fetch
?

kind regards
Martin


PS: Sorry, unable to correctly link the gitlab guide and InstallBuiltinLfsCommand.java as users without one post are unable to include links.
Previous Topic:Eclipse EGit TFS Git Connection - Authentication not supported
Next Topic:[Feature request] Remember password for GPG key when signing git commits (linux)
Goto Forum:
  


Current Time: Sat Oct 01 14:51:43 GMT 2022

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

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

Back to the top