From: Chris Aniszczyk Date: Mon, 14 Mar 2011 22:01:06 +0000 (-0500) Subject: CloneCommand: add a test to ensure we fetch all tags X-Git-Tag: v0.12.1~78^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fchanges%2F14%2F2714%2F1;p=jgit.git CloneCommand: add a test to ensure we fetch all tags Bug: 326611 Change-Id: Ibf9a7caa84d99f39fca88bebc10c03b01955146d Signed-off-by: Chris Aniszczyk --- diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java index eb671a2899..51ae054da3 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java @@ -49,17 +49,25 @@ import static org.junit.Assert.fail; import java.io.File; import java.io.IOException; +import org.eclipse.jgit.junit.TestRepository; import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.RefUpdate; +import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.RepositoryTestCase; +import org.eclipse.jgit.revwalk.RevBlob; import org.junit.Test; public class CloneCommandTest extends RepositoryTestCase { private Git git; + private TestRepository tr; + public void setUp() throws Exception { super.setUp(); + tr = new TestRepository(db); + git = new Git(db); // commit something writeTrashFile("Test.txt", "Hello world"); @@ -75,6 +83,8 @@ public class CloneCommandTest extends RepositoryTestCase { writeTrashFile("Test.txt", "Some change"); git.add().addFilepattern("Test.txt").call(); git.commit().setMessage("Second commit").call(); + RevBlob blob = tr.blob("blob-not-in-master-branch"); + git.tag().setName("tag-for-blob").setObjectId(blob).call(); } @Test @@ -87,6 +97,8 @@ public class CloneCommandTest extends RepositoryTestCase { + git.getRepository().getWorkTree().getPath()); Git git2 = command.call(); assertNotNull(git2); + ObjectId id = git2.getRepository().resolve("tag-for-blob"); + assertNotNull(id); } catch (Exception e) { fail(e.getMessage()); }