jgit checkout cost too long time [message #1853577] |
Fri, 08 July 2022 13:21 |
Zhiqiang Ren 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!
|
|
|
|
Powered by
FUDForum. Page generated in 0.09501 seconds