Improvement #2051
Support single branch cloning in GitCR
Start date:
09.12.2019
Due date:
% Done:
0%
Estimated time:
origin:
Description
Acceptance Criteria¶
- Only the needed branch should be cloned
- Preferrably only a shallow clone should be created
- Alternatively, we could switch to per-component checkout from the repo.
Implementation Hint¶
- See https://bugs.eclipse.org/bugs/show_bug.cgi?id=466858 for a starting point
For example, the following code should (but seemingly does not yet) only clone a single branch:
package com.zfabrik.gitcr.test; import java.io.File; import java.util.Arrays; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.ListBranchCommand.ListMode; import org.eclipse.jgit.lib.ProgressMonitor; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; public class TestCheckout { /** * https://bugs.eclipse.org/bugs/show_bug.cgi?id=466858 */ public static void main(String[] args) throws Exception { Git r = Git.cloneRepository() .setCredentialsProvider(new UsernamePasswordCredentialsProvider("..","..")) .setDirectory(new File("somewhere")) .setURI("https://somehost/repo") .setCloneAllBranches(false) .setBranchesToClone(Arrays.asList("refs/heads/master")) .call(); } }
Updated by Henning Blohm almost 5 years ago
- Target version changed from 2.8 to 2.9
This is currently not supported by JGit on the client. Implementing it independently is too much work. Instead, we might support a simpler SSH-based generic repo.