diff --git a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java index f32ab84f5530..32afb7cc84bd 100644 --- a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java +++ b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java @@ -483,14 +483,16 @@ public class GitCheckinEnvironment implements CheckinEnvironment { } private static void reset(@NotNull Project project, @NotNull VirtualFile root, @NotNull Collection changes) throws VcsException { - Set paths = new HashSet<>(); - paths.addAll(mapNotNull(changes, ChangesUtil::getAfterPath)); - paths.addAll(mapNotNull(changes, ChangesUtil::getBeforePath)); + Set allPaths = new HashSet<>(); + allPaths.addAll(mapNotNull(changes, ChangesUtil::getAfterPath)); + allPaths.addAll(mapNotNull(changes, ChangesUtil::getBeforePath)); - GitLineHandler handler = new GitLineHandler(project, root, GitCommand.RESET); - handler.endOptions(); - handler.addRelativePaths(paths); - Git.getInstance().runCommand(handler).getOutputOrThrow(); + for (List paths : VcsFileUtil.chunkPaths(root, allPaths)) { + GitLineHandler handler = new GitLineHandler(project, root, GitCommand.RESET); + handler.endOptions(); + handler.addParameters(paths); + Git.getInstance().runCommand(handler).getOutputOrThrow(); + } } public List commit(List changes, String preparedComment) {