diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java index 48901b37f6d5..6b0a4034a30f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java @@ -1166,8 +1166,9 @@ public class ShelveChangesManager implements PersistentStateComponent, try { final CommitContext commitContext = new CommitContext(); final List patches = new ArrayList<>(); - for (ShelvedChange change : listCopy.getChanges(myProject)) { - patches.add(change.loadFilePatch(myProject, commitContext)); + List filePatches = loadPatches(myProject, listCopy.PATH, commitContext); + for (ShelvedChange change : Objects.requireNonNull(listCopy.getChanges(myProject))) { + patches.add(find(filePatches, patch -> change.getBeforePath().equals(patch.getBeforeName()))); } writePatchesToFile(myProject, listCopy.PATH, patches, commitContext); }