Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions jgit/src/main/java/org/openrewrite/jgit/api/ApplyCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ private void applyText(Repository repository, String path, RawText rt,
// We assume hunks to be ordered
if (hh.getNewStartLine() <= lastHunkNewLine) {
throw new PatchApplyException(MessageFormat
.format(JGitText.get().patchApplyException, hh));
.format(JGitText.get().patchApplyErrorWithHunk, path, hh, "hunk out of sequence"));
}
lastHunkNewLine = hh.getNewStartLine();

Expand All @@ -622,7 +622,7 @@ && canApplyAt(hunkLines, newLines, 0)) {
break;
}
throw new PatchApplyException(MessageFormat
.format(JGitText.get().patchApplyException, hh));
.format(JGitText.get().patchApplyErrorWithHunk, path, hh, "cannot apply hunk"));
}
// Hunk lines as reported by the hunk may be off, so don't rely on
// them.
Expand All @@ -634,7 +634,7 @@ && canApplyAt(hunkLines, newLines, 0)) {
}
if (applyAt < afterLastHunk) {
throw new PatchApplyException(MessageFormat
.format(JGitText.get().patchApplyException, hh));
.format(JGitText.get().patchApplyErrorWithHunk, path, hh, "hunk application position overlaps with previous hunk"));
}
boolean applies = false;
int oldLinesInHunk = hh.getLinesContext()
Expand Down Expand Up @@ -673,7 +673,7 @@ && canApplyAt(hunkLines, newLines, 0)) {
}
if (!applies) {
throw new PatchApplyException(MessageFormat
.format(JGitText.get().patchApplyException, hh));
.format(JGitText.get().patchApplyErrorWithHunk, path, hh, "hunk does not apply to file content"));
}
// Hunk applies at applyAt. Apply it, and update afterLastHunk and
// lineNumberShift
Expand Down