summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorTommi Siivola2012-09-12 01:19:30 (EDT)
committer Tommi Siivola2012-09-12 06:11:57 (EDT)
commit0e56f347528fb333a344aaec126ea391ff18e43b (patch)
tree4649f358fc1f070fc2c8dd5657a14336d13c4141
parente5cd1d4add6f3bcaad2fb5f0158a697658d308cb (diff)
downloadjgit-0e56f347528fb333a344aaec126ea391ff18e43b.zip
jgit-0e56f347528fb333a344aaec126ea391ff18e43b.tar.gz
jgit-0e56f347528fb333a344aaec126ea391ff18e43b.tar.bz2
Fix ResolveMerger issue with submodule conflictrefs/changes/23/7723/2
ResolveMerger throws a MissingObjectException when it encounters a submodule conflict while merging. The reason is that it treats the submodule link as a blob and tries to read its contents. We solve the issue by detecting before content merge whether the path to be merged is a submodule link, and skip the content merge if it is. Bug: 389238 Change-Id: I9a58dfc7716b28a21f5c04cf3a865091ae8dfe7e Signed-off-by: Tommi Siivola <tommi.siivola@eficode.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
index 212938e..1782bb2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
@@ -538,6 +538,15 @@ public class ResolveMerger extends ThreeWayMerger {
if (isWorktreeDirty(work))
return false;
+ // Don't attempt to resolve submodule link conflicts
+ if (isGitLink(modeO) || isGitLink(modeT)) {
+ add(tw.getRawPath(), base, DirCacheEntry.STAGE_1, 0, 0);
+ add(tw.getRawPath(), ours, DirCacheEntry.STAGE_2, 0, 0);
+ add(tw.getRawPath(), theirs, DirCacheEntry.STAGE_3, 0, 0);
+ unmergedPaths.add(tw.getPathString());
+ return true;
+ }
+
MergeResult<RawText> result = contentMerge(base, ours, theirs);
File of = writeMergedFile(result);
updateIndex(base, ours, theirs, result, of);
@@ -770,6 +779,10 @@ public class ResolveMerger extends ThreeWayMerger {
return mode != 0 && !FileMode.TREE.equals(mode);
}
+ private static boolean isGitLink(final int mode) {
+ return FileMode.GITLINK.equals(mode);
+ }
+
@Override
public ObjectId getResultTreeId() {
return (resultTree == null) ? null : resultTree.toObjectId();