diff options
author | Patrick Hiesel <hiesel@google.com> | 2024-05-27 10:16:34 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2024-05-27 18:02:05 +0200 |
commit | f5f33be8ca9b49c506d6f0ea296b65c5d649aaa4 (patch) | |
tree | ffd9f4271361503a237942203f1a79567d6a2820 | |
parent | 4a6d04b25b211faf6498ce8ae9ee034be3566dc7 (diff) | |
download | jgit-f5f33be8ca9b49c506d6f0ea296b65c5d649aaa4.tar.gz jgit-f5f33be8ca9b49c506d6f0ea296b65c5d649aaa4.zip |
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
-rw-r--r-- | org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/allowconflict_file_deleted.patch | 10 | ||||
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchApplierTest.java | 10 |
2 files changed, 20 insertions, 0 deletions
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 0000000000..c9655a5e6b --- /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 2e529b5e93..8f3478db18 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 class PatchApplierTest { } @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"); |