[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jgit-dev] ColneCommand won't clone all branches
|
Hi,
On Sun, May 22, 2011 at 14:04, Ketan Padegaonkar
<ketanpadegaonkar@xxxxxxxxx> wrote:
>
> I can confirm that this does not work on master. There are no usages of
> CloneCommand#setCloneAllBranches and that the method is practically a no-op
> and the javadoc is lying :)
I was trying to reproduce but for me it works. In the current version
it is definitly not true that setCloneAllBranches() is a noop. If you
call it with "true" we'll add the refspec
"+refs/heads/*:refs/remotes/origin/*" before we fetch. So, maybe you
have an old version. I also checked with this code snippet:
File tmpDir = new File(System.getProperty("java.io.tmpdir"), "tmp"
+ System.currentTimeMillis());
Git repo1 = Git.cloneRepository()
.setURI("http://github.com/chalstrick/mergeExample.git")
.setDirectory(new File(tmpDir, "repo1")).call();
for (Ref b : repo1.branchList().setListMode(ListMode.ALL).call())
System.out.println("(standard): cloned branch " + b.getName());
Git repo2 = Git.cloneRepository()
.setURI("http://github.com/chalstrick/mergeExample.git")
.setDirectory(new File(tmpDir, "repo2"))
.setCloneAllBranches(true).call();
for (Ref b : repo2.branchList().setListMode(ListMode.ALL).call())
System.out.println("(cloneAllBranches): cloned branch " + b.getName());
Git repo3 = Git.cloneRepository()
.setURI("http://github.com/chalstrick/mergeExample.git")
.setDirectory(new File(tmpDir, "repo3"))
.setBranchesToClone(Arrays.asList("refs/heads/master")).call();
for (Ref b : repo3.branchList().setListMode(ListMode.ALL).call())
System.out.println("(cloneSingleBranch): cloned branch " + b.getName());
That returns for me the expected:
(standard): cloned branch refs/heads/master
(standard): cloned branch refs/remotes/origin/master
(standard): cloned branch refs/remotes/origin/side
(cloneAllBranches): cloned branch refs/heads/master
(cloneAllBranches): cloned branch refs/remotes/origin/master
(cloneAllBranches): cloned branch refs/remotes/origin/side
(cloneSingleBranch): cloned branch refs/heads/master
(cloneSingleBranch): cloned branch refs/remotes/origin/master
Ciao
Chris