From 515b8c878d0084b51d2c7b1100fdc5ebf3c8a535 Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Tue, 5 Apr 2016 16:24:51 +0300 Subject: [PATCH] [patch]: remember last step after context instead of ignore it --- .../openapi/diff/impl/patch/apply/GenericPatchApplier.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/apply/GenericPatchApplier.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/apply/GenericPatchApplier.java index b8b4ee3ead59..ad2d9e7e60a3 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/apply/GenericPatchApplier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/apply/GenericPatchApplier.java @@ -180,7 +180,8 @@ public class GenericPatchApplier { final List>> steps = copy.getPatchSteps(); final BeforeAfter> first = steps.get(0); - final BeforeAfter> last = steps.get(steps.size() - 1); + final int lastStepIndex = steps.size() - 1; + final BeforeAfter> last = steps.get(lastStepIndex); final BeforeAfter> firstCopy = copyBeforeAfter(first); steps.set(0, firstCopy); @@ -194,6 +195,7 @@ public class GenericPatchApplier { final BeforeAfter> lastCopy = copyBeforeAfter(last); lastCopy.getBefore().addAll(hunk.getContextAfter()); lastCopy.getAfter().addAll(hunk.getContextAfter()); + steps.set(lastStepIndex, lastCopy); } return copy; }