Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » jgit checkout cost too long time
jgit checkout cost too long time [message #1853577] Fri, 08 July 2022 13:21 Go to next message
Zhiqiang Ren is currently offline Zhiqiang RenFriend
Messages: 1
Registered: July 2022
Junior Member
Hi,
I have a remote git repo, with some branches,for instance:master、feature/branchA、feature/branchB.

Like the master branch, the feature/branchB branch has several small files.The difference between the master branch and feature/branchA is that feature/branchA has a large file, about 90M.
I use jgit to manage local branches.I first clone all branches from my remote repo,like this:
        System.out.println("=========== start clone =============");
        Git git = Git.cloneRepository()
                .setURI(cloneUrl)
                .setCredentialsProvider(usernamePasswordCredentialsProvider)
                .setDirectory(new File(clonedDir))
                .setCloneAllBranches(true)
                .call();
        System.out.println("=========== clone success =============");

then, I need to checkout between the three branches,like this:
               // whether local exist the branchName
               boolean flag = localBranchIsExist(branchName);
                if (flag) {
                    System.out.println("create local branch: " + branchName);
                    git.checkout()
                            .setCreateBranch(true)
                            .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM)
                            .setStartPoint("origin/" + branchName)
                            .setName(branchName)
                            .call();
                } else {
                    System.out.println(branchName + " branch already exist!");
                    git.checkout().setName(branchName).call();
                }

my question is :According to my practice,when i am at master branch,icheckout to feature/branchB, same as the master,it just cost a little time;but when i am at master branch ,thencheckout to feature/branchA, it cost a long time,about one minute,because feature/branchA has a big file(90M)? Or maybe my checkout code is wrong? Can anyone help me?Thank you!
Re: jgit checkout cost too long time [message #1853653 is a reply to message #1853577] Tue, 12 July 2022 13:03 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1212
Registered: July 2009
Senior Member
Try to increase core.streamFileThreshold to a size larger than your largest versioned file.
By default this threshold is 50MiB.
You may also want to check the max. Java heap size you configured.

On a side note it's not a good idea to store huge (probably binary) files in git. It's not designed
for general purpose data storage but for versioning source code (text).

[1] https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/refs/heads/master/Documentation/config-options.md
Previous Topic:What is the proper way to stage / unstage specific lines in a diff?
Next Topic:is GIT required
Goto Forum:
  


Current Time: Sun Sep 25 15:44:26 GMT 2022

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

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

Back to the top