PatchApplier: Add test for conflict markers on a deleted file For deleted files, we want to keep erroring out even if conflicts are allowed for the apply patch logic. The resulting file would otherwise only consist of the patch. Change-Id: I18defa627ad2223a3a917d2b0ee4189396732533
diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/allowconflict_file_deleted.patch b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/allowconflict_file_deleted.patch new file mode 100644 index 0000000..c9655a5 --- /dev/null +++ b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/allowconflict_file_deleted.patch
@@ -0,0 +1,10 @@ +diff --git a/allowconflict_file_deleted b/allowconflict_file_deleted +index 0000000..de98044 +--- a/allowconflict_file_deleted ++++ b/allowconflict_file_deleted +@@ -3,4 +3,4 @@ + line3 +-lineA ++lineB + line5 + line6
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchApplierTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchApplierTest.java index 2e529b5..8f3478d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchApplierTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchApplierTest.java
@@ -396,6 +396,16 @@ public void testConflictMarkersOutOfBounds() throws Exception { } @Test + public void testConflictMarkersFileDeleted() throws Exception { + init("allowconflict_file_deleted", false, false); + + Result result = applyPatchAllowConflicts(); + + assertEquals(1, result.getErrors().size()); + assertEquals(0, result.getPaths().size()); + } + + @Test public void testShiftUp() throws Exception { init("ShiftUp");