diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2014-12-04 01:47:21 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2014-12-22 15:45:46 +0100 |
commit | 15e8b4fb2e0367f1f66569da4e32ac730feb9119 (patch) | |
tree | e08491b9bfd2dc9d3987ebd5a46a2b7371ddabad /org.eclipse.jgit.pgm.test/tst/org/eclipse | |
parent | 563c1ad514ada9af13f2a1955a10000137804527 (diff) | |
download | jgit-15e8b4fb2e0367f1f66569da4e32ac730feb9119.tar.gz jgit-15e8b4fb2e0367f1f66569da4e32ac730feb9119.zip |
[pgm] Add option --bare to clone command
Change-Id: I528491e3e20d3c9ebe37fe3cd2bf85b4644d8698
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm.test/tst/org/eclipse')
-rw-r--r-- | org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java index c65e162384..fe80388c0c 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java @@ -44,6 +44,7 @@ package org.eclipse.jgit.pgm; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.io.File; import java.util.List; @@ -133,4 +134,23 @@ public class CloneTest extends CLIRepositoryTestCase { List<Ref> branches = git2.branchList().call(); assertEquals("expected 1 branch", 1, branches.size()); } + + public void testCloneBare() throws Exception { + createInitialCommit(); + + File gitDir = db.getDirectory(); + String sourcePath = gitDir.getAbsolutePath(); + String targetPath = (new File(sourcePath)).getParentFile() + .getParentFile().getAbsolutePath() + + "/target.git"; + StringBuilder cmd = new StringBuilder("git clone --bare ") + .append(sourcePath + " " + targetPath); + String[] result = execute(cmd.toString()); + assertArrayEquals(new String[] { + "Cloning into '" + targetPath + "'...", "", "" }, result); + Git git2 = Git.open(new File(targetPath)); + List<Ref> branches = git2.branchList().call(); + assertEquals("expected 1 branch", 1, branches.size()); + assertTrue("expected bare repository", git2.getRepository().isBare()); + } } |