diff options
author | RĂ¼diger Herrmann <ruediger.herrmann@gmx.de> | 2015-01-31 00:09:27 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2015-02-04 13:35:32 +0100 |
commit | fc801dd79f7c6eb3765e4652136f219480478bf6 (patch) | |
tree | e79b6c19661392cad7c985199bcf7d804536afe1 /org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit | |
parent | 3c2b4086b61798ad8c48536d34b5abe922567ad7 (diff) | |
download | jgit-fc801dd79f7c6eb3765e4652136f219480478bf6.tar.gz jgit-fc801dd79f7c6eb3765e4652136f219480478bf6.zip |
Add option --orphan for checkout
Change-Id: I546a93f3e147d8d6fc70094b22679c0d11cd8921
Signed-off-by: RĂ¼diger Herrmann <ruediger.herrmann@gmx.de>
Diffstat (limited to 'org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit')
-rw-r--r-- | org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CheckoutTest.java | 12 |
1 files changed, 12 insertions, 0 deletions
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: * <ol> |