summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2014-08-01 11:28:01 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2014-08-02 23:04:26 +0200
commitddbf67e0588379f2a063cf57b1d3ca926b43e63d (patch)
tree71aa6d9e02b676f8e9626e6d5714c3aac18c8fff /org.eclipse.jgit.test
parentfd07ee54efc944e9af29bf31b4af9c0218f47bac (diff)
downloadjgit-ddbf67e0588379f2a063cf57b1d3ca926b43e63d.tar.gz
jgit-ddbf67e0588379f2a063cf57b1d3ca926b43e63d.zip
IndexDiffFilter should never filter entries with stage!=0
If the IndexDiffFilter is asked whether it should include or filter out a certain path and for that path there is a dircache entry with a stage different from 0, then the filter should never filter out this entry. IndexDiffFilter is an optimized version of AnyDiffFilter and there is no case where the index contains non-0 stages but we still don't see any diff for that path. Change-Id: I25915880f304090fe90584c79bddf021231227a2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java
index c95274f68f..bb4b066bf8 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java
@@ -135,6 +135,31 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
}
@Test
+ public void testConflicts() throws Exception {
+ RevCommit initial = git.commit().setMessage("initial").call();
+ writeTrashFile(FILE, "master");
+ git.add().addFilepattern(FILE).call();
+ RevCommit master = git.commit().setMessage("master").call();
+ git.checkout().setName("refs/heads/side")
+ .setCreateBranch(true).setStartPoint(initial).call();
+ writeTrashFile(FILE, "side");
+ git.add().addFilepattern(FILE).call();
+ RevCommit side = git.commit().setMessage("side").call();
+ assertFalse(git.merge().include("master", master).call()
+ .getMergeStatus()
+ .isSuccessful());
+ assertEquals(read(FILE),
+ "<<<<<<< HEAD\nside\n=======\nmaster\n>>>>>>> master\n");
+ writeTrashFile(FILE, "master");
+
+ TreeWalk treeWalk = createTreeWalk(side);
+ int count = 0;
+ while (treeWalk.next())
+ count++;
+ assertEquals(2, count);
+ }
+
+ @Test
public void testFileInFolderCommitted() throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
TreeWalk treeWalk = createTreeWalk(commit);