diff options
author | Nitzan Gur-Furman <nitzan@google.com> | 2023-03-03 14:24:19 +0100 |
---|---|---|
committer | Nitzan Gur-Furman <nitzan@google.com> | 2023-03-28 11:18:08 +0200 |
commit | 3a913a8c341aba00f6b16aa1814ba75b83273972 (patch) | |
tree | 4c58cb9878948eb6f0764a165b2b37e575de38d9 /org.eclipse.jgit.test/tst-rsrc | |
parent | 228e4de4841a694bf55ff38212822fca46b7b080 (diff) | |
download | jgit-3a913a8c341aba00f6b16aa1814ba75b83273972.tar.gz jgit-3a913a8c341aba00f6b16aa1814ba75b83273972.zip |
Fix PatchApplier error handling.
1. For general errors, throw IOException instead of wrapping them with
PatchApplyException. The wrapping was moved (back) to ApplyCommand.
2. For file specific errors, log the errors as part of
PatchApplier::Result.
3. Change applyPatch() to receive the parsed Patch object, so the caller
can decide how to handle parsing errors.
Background: this utility class was extracted from ApplyCommand on V6.4.0.
During the extraction, we left the exception wrapping by
PatchApplyException intact. This attitude made it harder for the callers to
distinguish between the actual error causes.
Change-Id: Ib0f2b5e97a13df2339d8b65f2fea1c819c161ac3
Diffstat (limited to 'org.eclipse.jgit.test/tst-rsrc')
3 files changed, 10 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/conflict.patch b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/conflict.patch new file mode 100644 index 0000000000..547fcdae26 --- /dev/null +++ b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/conflict.patch @@ -0,0 +1,8 @@ +diff --git a/conflict b/conflict +index 2e65efe..7898192 100644 +--- a/conflict ++++ b/conflict +@@ -1 +1 @@ +-a different preimage line +\ No newline at end of file ++a new line diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/conflict_PostImage b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/conflict_PostImage new file mode 100644 index 0000000000..fa27877b05 --- /dev/null +++ b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/conflict_PostImage @@ -0,0 +1 @@ +preimage line diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/conflict_PreImage b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/conflict_PreImage new file mode 100644 index 0000000000..fa27877b05 --- /dev/null +++ b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/conflict_PreImage @@ -0,0 +1 @@ +preimage line |