mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-144511 patch: do not report "Unknown File Type" for new files
This commit is contained in:
+3
-3
@@ -170,10 +170,10 @@ public class DiffShelvedChangesAction extends AnAction implements DumbAware {
|
||||
for (final ShelvedChange shelvedChange : changesFromFirstList) {
|
||||
final String beforePath = shelvedChange.getBeforePath();
|
||||
final String afterPath = shelvedChange.getAfterPath();
|
||||
final boolean isNewFile = FileStatus.ADDED.equals(shelvedChange.getFileStatus());
|
||||
|
||||
final VirtualFile file;
|
||||
final VirtualFile file; // isNewFile -> parent directory, !isNewFile -> file
|
||||
try {
|
||||
boolean isNewFile = FileStatus.ADDED.equals(shelvedChange.getFileStatus());
|
||||
file = ApplyFilePatchBase.findPatchTarget(patchContext, beforePath, afterPath, isNewFile);
|
||||
if (!isNewFile && (file == null || !file.exists())) throw new FileNotFoundException(beforePath);
|
||||
}
|
||||
@@ -194,7 +194,7 @@ public class DiffShelvedChangesAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public DiffRequest process(@NotNull UserDataHolder context, @NotNull ProgressIndicator indicator)
|
||||
throws DiffRequestProducerException, ProcessCanceledException {
|
||||
if (file != null && file.getFileType() == UnknownFileType.INSTANCE) {
|
||||
if (!isNewFile && file.getFileType() == UnknownFileType.INSTANCE) {
|
||||
return new UnknownFileTypeDiffRequest(file, getName());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user