diff options
author | Ned Twigg <ned.twigg@diffplug.com> | 2016-03-18 02:46:38 -0700 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2016-10-22 10:08:07 +0900 |
commit | e49025386eee85f4748b3f16ae2c63f6ff94f335 (patch) | |
tree | a707308582dae48c0deeb0e0a18fe8ff51519208 /org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit | |
parent | c6459a6167b72039f94f05c00566ce7a324ec23a (diff) | |
download | jgit-e49025386eee85f4748b3f16ae2c63f6ff94f335.tar.gz jgit-e49025386eee85f4748b3f16ae2c63f6ff94f335.zip |
Checkout: Add the ability to checkout all paths.
Change-Id: Ie1e59c566b63d0dfac231e44e7ebd7f3f08f3e9f
Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
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 | 25 |
1 files changed, 24 insertions, 1 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 3651542fc6..4b86b6014e 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 @@ -613,7 +613,30 @@ public class CheckoutTest extends CLIRepositoryTestCase { } @Test - public void testCheckouSingleFile() throws Exception { + public void testCheckoutAllPaths() throws Exception { + try (Git git = new Git(db)) { + writeTrashFile("a", "Hello world a"); + git.add().addFilepattern(".").call(); + git.commit().setMessage("commit file a").call(); + git.branchCreate().setName("branch_1").call(); + git.checkout().setName("branch_1").call(); + File b = writeTrashFile("b", "Hello world b"); + git.add().addFilepattern("b").call(); + git.commit().setMessage("commit file b").call(); + File a = writeTrashFile("a", "New Hello world a"); + git.add().addFilepattern(".").call(); + git.commit().setMessage("modified a").call(); + assertArrayEquals(new String[] { "" }, + execute("git checkout HEAD~2 -- .")); + assertEquals("Hello world a", read(a)); + assertArrayEquals(new String[] { "* branch_1", " master", "" }, + execute("git branch")); + assertEquals("Hello world b", read(b)); + } + } + + @Test + public void testCheckoutSingleFile() throws Exception { try (Git git = new Git(db)) { File a = writeTrashFile("a", "file a"); git.add().addFilepattern(".").call(); |