|
|
|
@ -44,7 +44,6 @@
|
|
|
|
|
|
|
|
|
|
package org.eclipse.jgit.merge; |
|
|
|
|
|
|
|
|
|
import static org.eclipse.jgit.lib.Constants.OBJ_BLOB; |
|
|
|
|
import static org.junit.Assert.assertEquals; |
|
|
|
|
import static org.junit.Assert.assertFalse; |
|
|
|
|
import static org.junit.Assert.assertTrue; |
|
|
|
@ -53,9 +52,7 @@ import java.io.IOException;
|
|
|
|
|
|
|
|
|
|
import org.eclipse.jgit.dircache.DirCache; |
|
|
|
|
import org.eclipse.jgit.dircache.DirCacheBuilder; |
|
|
|
|
import org.eclipse.jgit.dircache.DirCacheEntry; |
|
|
|
|
import org.eclipse.jgit.lib.CommitBuilder; |
|
|
|
|
import org.eclipse.jgit.lib.Constants; |
|
|
|
|
import org.eclipse.jgit.lib.FileMode; |
|
|
|
|
import org.eclipse.jgit.lib.ObjectId; |
|
|
|
|
import org.eclipse.jgit.lib.ObjectInserter; |
|
|
|
@ -123,15 +120,15 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
|
|
|
|
|
final DirCacheBuilder o = treeO.builder(); |
|
|
|
|
final DirCacheBuilder t = treeT.builder(); |
|
|
|
|
|
|
|
|
|
b.add(makeEntry("libelf-po/a", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(makeEntry("libelf/c", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(createEntry("libelf-po/a", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(createEntry("libelf/c", FileMode.REGULAR_FILE)); |
|
|
|
|
|
|
|
|
|
o.add(makeEntry("Makefile", FileMode.REGULAR_FILE)); |
|
|
|
|
o.add(makeEntry("libelf-po/a", FileMode.REGULAR_FILE)); |
|
|
|
|
o.add(makeEntry("libelf/c", FileMode.REGULAR_FILE)); |
|
|
|
|
o.add(createEntry("Makefile", FileMode.REGULAR_FILE)); |
|
|
|
|
o.add(createEntry("libelf-po/a", FileMode.REGULAR_FILE)); |
|
|
|
|
o.add(createEntry("libelf/c", FileMode.REGULAR_FILE)); |
|
|
|
|
|
|
|
|
|
t.add(makeEntry("libelf-po/a", FileMode.REGULAR_FILE)); |
|
|
|
|
t.add(makeEntry("libelf/c", FileMode.REGULAR_FILE, "blah")); |
|
|
|
|
t.add(createEntry("libelf-po/a", FileMode.REGULAR_FILE)); |
|
|
|
|
t.add(createEntry("libelf/c", FileMode.REGULAR_FILE, "blah")); |
|
|
|
|
|
|
|
|
|
b.finish(); |
|
|
|
|
o.finish(); |
|
|
|
@ -176,14 +173,14 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
|
|
|
|
|
final DirCacheBuilder o = treeO.builder(); |
|
|
|
|
final DirCacheBuilder t = treeT.builder(); |
|
|
|
|
|
|
|
|
|
b.add(makeEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(makeEntry("d/t", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(createEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(createEntry("d/t", FileMode.REGULAR_FILE)); |
|
|
|
|
|
|
|
|
|
o.add(makeEntry("d/o", FileMode.REGULAR_FILE, "o !")); |
|
|
|
|
o.add(makeEntry("d/t", FileMode.REGULAR_FILE)); |
|
|
|
|
o.add(createEntry("d/o", FileMode.REGULAR_FILE, "o !")); |
|
|
|
|
o.add(createEntry("d/t", FileMode.REGULAR_FILE)); |
|
|
|
|
|
|
|
|
|
t.add(makeEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
t.add(makeEntry("d/t", FileMode.REGULAR_FILE, "t !")); |
|
|
|
|
t.add(createEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
t.add(createEntry("d/t", FileMode.REGULAR_FILE, "t !")); |
|
|
|
|
|
|
|
|
|
b.finish(); |
|
|
|
|
o.finish(); |
|
|
|
@ -224,14 +221,14 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
|
|
|
|
|
final DirCacheBuilder o = treeO.builder(); |
|
|
|
|
final DirCacheBuilder t = treeT.builder(); |
|
|
|
|
|
|
|
|
|
b.add(makeEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(makeEntry("d/t", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(createEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(createEntry("d/t", FileMode.REGULAR_FILE)); |
|
|
|
|
|
|
|
|
|
o.add(makeEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
o.add(makeEntry("d/t", FileMode.REGULAR_FILE, "o !")); |
|
|
|
|
o.add(createEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
o.add(createEntry("d/t", FileMode.REGULAR_FILE, "o !")); |
|
|
|
|
|
|
|
|
|
t.add(makeEntry("d/o", FileMode.REGULAR_FILE, "t !")); |
|
|
|
|
t.add(makeEntry("d/t", FileMode.REGULAR_FILE, "t !")); |
|
|
|
|
t.add(createEntry("d/o", FileMode.REGULAR_FILE, "t !")); |
|
|
|
|
t.add(createEntry("d/t", FileMode.REGULAR_FILE, "t !")); |
|
|
|
|
|
|
|
|
|
b.finish(); |
|
|
|
|
o.finish(); |
|
|
|
@ -258,13 +255,13 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
|
|
|
|
|
final DirCacheBuilder o = treeO.builder(); |
|
|
|
|
final DirCacheBuilder t = treeT.builder(); |
|
|
|
|
|
|
|
|
|
b.add(makeEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(makeEntry("d/t", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(createEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(createEntry("d/t", FileMode.REGULAR_FILE)); |
|
|
|
|
|
|
|
|
|
o.add(makeEntry("d", FileMode.REGULAR_FILE)); |
|
|
|
|
o.add(createEntry("d", FileMode.REGULAR_FILE)); |
|
|
|
|
|
|
|
|
|
t.add(makeEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
t.add(makeEntry("d/t", FileMode.REGULAR_FILE, "t !")); |
|
|
|
|
t.add(createEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
t.add(createEntry("d/t", FileMode.REGULAR_FILE, "t !")); |
|
|
|
|
|
|
|
|
|
b.finish(); |
|
|
|
|
o.finish(); |
|
|
|
@ -291,13 +288,13 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
|
|
|
|
|
final DirCacheBuilder o = treeO.builder(); |
|
|
|
|
final DirCacheBuilder t = treeT.builder(); |
|
|
|
|
|
|
|
|
|
b.add(makeEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(makeEntry("d/t", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(createEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(createEntry("d/t", FileMode.REGULAR_FILE)); |
|
|
|
|
|
|
|
|
|
o.add(makeEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
o.add(makeEntry("d/t", FileMode.REGULAR_FILE, "o !")); |
|
|
|
|
o.add(createEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
o.add(createEntry("d/t", FileMode.REGULAR_FILE, "o !")); |
|
|
|
|
|
|
|
|
|
t.add(makeEntry("d", FileMode.REGULAR_FILE)); |
|
|
|
|
t.add(createEntry("d", FileMode.REGULAR_FILE)); |
|
|
|
|
|
|
|
|
|
b.finish(); |
|
|
|
|
o.finish(); |
|
|
|
@ -324,11 +321,11 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
|
|
|
|
|
final DirCacheBuilder o = treeO.builder(); |
|
|
|
|
final DirCacheBuilder t = treeT.builder(); |
|
|
|
|
|
|
|
|
|
b.add(makeEntry("d", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(createEntry("d", FileMode.REGULAR_FILE)); |
|
|
|
|
|
|
|
|
|
o.add(makeEntry("d", FileMode.REGULAR_FILE, "o !")); |
|
|
|
|
o.add(createEntry("d", FileMode.REGULAR_FILE, "o !")); |
|
|
|
|
|
|
|
|
|
t.add(makeEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
t.add(createEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
|
|
|
|
|
b.finish(); |
|
|
|
|
o.finish(); |
|
|
|
@ -355,11 +352,11 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
|
|
|
|
|
final DirCacheBuilder o = treeO.builder(); |
|
|
|
|
final DirCacheBuilder t = treeT.builder(); |
|
|
|
|
|
|
|
|
|
b.add(makeEntry("d", FileMode.REGULAR_FILE)); |
|
|
|
|
b.add(createEntry("d", FileMode.REGULAR_FILE)); |
|
|
|
|
|
|
|
|
|
o.add(makeEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
o.add(createEntry("d/o", FileMode.REGULAR_FILE)); |
|
|
|
|
|
|
|
|
|
t.add(makeEntry("d", FileMode.REGULAR_FILE, "t !")); |
|
|
|
|
t.add(createEntry("d", FileMode.REGULAR_FILE, "t !")); |
|
|
|
|
|
|
|
|
|
b.finish(); |
|
|
|
|
o.finish(); |
|
|
|
@ -393,18 +390,4 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
|
|
|
|
|
odi.flush(); |
|
|
|
|
return id; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private DirCacheEntry makeEntry(final String path, final FileMode mode) |
|
|
|
|
throws Exception { |
|
|
|
|
return makeEntry(path, mode, path); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private DirCacheEntry makeEntry(final String path, final FileMode mode, |
|
|
|
|
final String content) throws Exception { |
|
|
|
|
final DirCacheEntry ent = new DirCacheEntry(path); |
|
|
|
|
ent.setFileMode(mode); |
|
|
|
|
ent.setObjectId(new ObjectInserter.Formatter().idFor(OBJ_BLOB, |
|
|
|
|
Constants.encode(content))); |
|
|
|
|
return ent; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|