summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2012-09-24 05:08:36 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2012-09-24 05:08:36 -0400
commit1d08015cad0ff042d527acf90cb873fafd7c7867 (patch)
tree80491cb1134909850899428c7ba08e3cb6e100a4 /org.eclipse.jgit.test/tst/org
parent68a91801d76c0cb9d6439a1806e57ea3a8b4e91a (diff)
parentac805874f72fe2c6193bc959865fb525e069e45e (diff)
downloadjgit-1d08015cad0ff042d527acf90cb873fafd7c7867.tar.gz
jgit-1d08015cad0ff042d527acf90cb873fafd7c7867.zip
Merge "Refuse to checkout unmerged paths from index"
Diffstat (limited to 'org.eclipse.jgit.test/tst/org')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PathCheckoutCommandTest.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PathCheckoutCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PathCheckoutCommandTest.java
index 243d791cd2..d37f57293d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PathCheckoutCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PathCheckoutCommandTest.java
@@ -47,11 +47,13 @@ import static org.junit.Assert.assertEquals;
import java.io.File;
import java.io.IOException;
+import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.errors.NoWorkTreeException;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.ObjectReader;
+import org.eclipse.jgit.lib.RepositoryState;
import org.eclipse.jgit.lib.RepositoryTestCase;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevCommit;
@@ -243,4 +245,23 @@ public class PathCheckoutCommandTest extends RepositoryTestCase {
assertEquals("1", read(test));
assertEquals("a", read(test2));
}
+
+ @Test(expected = JGitInternalException.class)
+ public void testCheckoutOfConflictingFileShouldThrow()
+ throws Exception {
+ // Setup
+ git.checkout().setCreateBranch(true).setName("conflict")
+ .setStartPoint(initialCommit).call();
+ writeTrashFile(FILE1, "Conflicting");
+ RevCommit conflict = git.commit().setAll(true)
+ .setMessage("Conflicting change").call();
+
+ git.checkout().setName("master").call();
+
+ git.merge().include(conflict).call();
+ assertEquals(RepositoryState.MERGING, db.getRepositoryState());
+
+ // Now check out the conflicting path
+ git.checkout().addPath(FILE1).call();
+ }
}