Project

General

Profile

Improvement #2051

Support single branch cloning in GitCR

Added by Henning Blohm over 4 years ago. Updated over 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
z2-core
Target version:
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

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();
    }

}

#1

Updated by Henning Blohm over 4 years ago

  • Description updated (diff)
#2

Updated by Henning Blohm over 4 years ago

  • Status changed from New to In Progress
#3

Updated by Henning Blohm over 4 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.

#4

Updated by Henning Blohm over 4 years ago

  • Target version changed from 2.9 to TBD
#5

Updated by Henning Blohm over 4 years ago

  • Status changed from In Progress to Resolved

Also available in: Atom PDF