From e60ea7324f37bd0a1086e27fad52ecc5232e9c06 Mon Sep 17 00:00:00 2001 From: Demetr Starshov Date: Tue, 11 Aug 2020 17:57:10 -0700 Subject: ResolveMerger: Adding test cases for GITLINK merge Add test cases which cover content-merge resolve logic. Git clients try to agressively merge blobs by content, but GITLINK types of entries can't be merged with each other or with blobs. This change ensures all possible permutations which can trigger blob and GITLINK content merge are covered. Signed-off-by: Demetr Starshov Change-Id: I7e83a28a14d4d2f9e0ba2b1cffbf3224fb7f3fef --- .../src/org/eclipse/jgit/junit/RepositoryTestCase.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'org.eclipse.jgit.junit') diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java index de11e2c004..cc84f197aa 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java @@ -34,6 +34,7 @@ import org.eclipse.jgit.dircache.DirCacheBuilder; import org.eclipse.jgit.dircache.DirCacheCheckout; import org.eclipse.jgit.dircache.DirCacheEntry; import org.eclipse.jgit.internal.storage.file.FileRepository; +import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.ObjectId; @@ -512,6 +513,21 @@ public abstract class RepositoryTestCase extends LocalDiskRepositoryTestCase { return entry; } + /** + * Create DirCacheEntry + * + * @param path + * @param objectId + * @return the DirCacheEntry + */ + protected DirCacheEntry createGitLink(String path, AnyObjectId objectId) { + final DirCacheEntry entry = new DirCacheEntry(path, + DirCacheEntry.STAGE_0); + entry.setFileMode(FileMode.GITLINK); + entry.setObjectId(objectId); + return entry; + } + /** * Assert files are equal * -- cgit v1.2.3