File (@NotNull Project project, @Nullable String commitMessage, File file, String extension) { @NonNls String defaultPath = shortenAndSanitize(commitMessage); while (true) { File nonexistentFile = FileUtil.findSequentNonexistentFile(file, defaultPath, extension == null ? VcsConfiguration.getInstance(project).getPatchFileExtension() : extension); if (nonexistentFile.getName().length() >= PatchNameChecker.MAX) { defaultPath = defaultPath.substring(0, defaultPath.length() - 1); continue; } return nonexistentFile; } }