diff --git a/plugins/git4idea/src/git4idea/GitUtil.java b/plugins/git4idea/src/git4idea/GitUtil.java index 8bb458675347..6b6cd8405420 100644 --- a/plugins/git4idea/src/git4idea/GitUtil.java +++ b/plugins/git4idea/src/git4idea/GitUtil.java @@ -855,4 +855,14 @@ public class GitUtil { } return hash; } + + @NotNull + public static String fileOrFolder(@NotNull VirtualFile file) { + if (file.isDirectory()) { + return "Folder"; + } + else { + return "File"; + } + } } diff --git a/plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java b/plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java index 691d5e08c88f..0ec99f63c5ee 100644 --- a/plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java +++ b/plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java @@ -209,9 +209,10 @@ public class GitCompareWithBranchAction extends DumbAwareAction { new GitDiffFromHistoryHandler(project).showDiffForTwo(new FilePathImpl(file), compareRevision, currentRevision); } - private static void fileDoesntExistInBranchError(Project project, VirtualFile file, String branchToCompare) { - GitUIUtil.notifyMessage(project, "File doesn't exist in branch", - String.format("File %s doesn't exist in branch %s", file.getPresentableUrl(), branchToCompare), + private static void fileDoesntExistInBranchError(@NotNull Project project, @NotNull VirtualFile file, @NotNull String branchToCompare) { + GitUIUtil.notifyMessage(project, GitUtil.fileOrFolder(file) + " doesn't exist in branch", + String.format("%s %s doesn't exist in branch %s", + GitUtil.fileOrFolder(file), file.getPresentableUrl(), branchToCompare), NotificationType.WARNING, true, null); } }