From fc801dd79f7c6eb3765e4652136f219480478bf6 Mon Sep 17 00:00:00 2001 From: RĂ¼diger Herrmann Date: Sat, 31 Jan 2015 00:09:27 +0100 Subject: Add option --orphan for checkout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I546a93f3e147d8d6fc70094b22679c0d11cd8921 Signed-off-by: RĂ¼diger Herrmann --- .../tst/org/eclipse/jgit/pgm/CheckoutTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'org.eclipse.jgit.pgm.test') diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CheckoutTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CheckoutTest.java index 90284736cf..cef9b9e1a6 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CheckoutTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CheckoutTest.java @@ -188,6 +188,18 @@ public class CheckoutTest extends CLIRepositoryTestCase { assertEquals("Hello world a", read(fileA)); } + @Test + public void testCheckoutOrphan() throws Exception { + Git git = new Git(db); + git.commit().setMessage("initial commit").call(); + + assertEquals("Switched to a new branch 'new_branch'", + execute("git checkout --orphan new_branch")); + assertEquals("refs/heads/new_branch", db.getRef("HEAD").getTarget().getName()); + RevCommit commit = git.commit().setMessage("orphan commit").call(); + assertEquals(0, commit.getParentCount()); + } + /** * Steps: *
    -- cgit v1.2.3