summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit
diff options
context:
space:
mode:
authorThomas Wolf <twolf@apache.org>2022-08-16 01:02:21 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2022-09-07 15:02:02 +0200
commita8e683fef6acf3e9f00ac2648fff60b13a28fb13 (patch)
treea83746d664b648d784aa441e18b28a33f2a1879d /org.eclipse.jgit.junit
parent583bf00233d2c3f0fc6b1e90f940d31e2dec5ad0 (diff)
downloadjgit-a8e683fef6acf3e9f00ac2648fff60b13a28fb13.tar.gz
jgit-a8e683fef6acf3e9f00ac2648fff60b13a28fb13.zip
[merge] Fix merge conflicts with symlinks
Previous code would do a content merge on symlinks, and write the merge result to the working tree as a file. C git doesn't do this; it leaves a symlink in the working tree unchanged, or in a delete-modify conflict it would check out "theirs". Moreover, previous code would write the merge result to the link target, not to the link. This would overwrite an existing link target, or fail if the link pointed to a directory. In link/file conflicts or file/link conflicts, C git always puts the file into the working tree. Change conflict handling accordingly. Add tests for all the conflict cases. Bug: 580347 Change-Id: I3cffcb4bcf8e336a85186031fff23f0c4b6ee19d Signed-off-by: Thomas Wolf <twolf@apache.org>
Diffstat (limited to 'org.eclipse.jgit.junit')
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
index 54e4a09ee5..483b9a7c81 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
@@ -276,6 +276,24 @@ public class TestRepository<R extends Repository> implements AutoCloseable {
}
/**
+ * Construct a symlink mode tree entry.
+ *
+ * @param path
+ * path of the symlink.
+ * @param blob
+ * a blob, previously constructed in the repository.
+ * @return the entry.
+ * @throws Exception
+ * @since 6.3
+ */
+ public DirCacheEntry link(String path, RevBlob blob) throws Exception {
+ DirCacheEntry e = new DirCacheEntry(path);
+ e.setFileMode(FileMode.SYMLINK);
+ e.setObjectId(blob);
+ return e;
+ }
+
+ /**
* Construct a tree from a specific listing of file entries.
*
* @param entries