private void handleResult(@NotNull GitCommandResult result,
                            @NotNull Project project,
                            @NotNull GitSimpleEventDetector mergeConflictDetector,
                            @NotNull GitLocalChangesWouldBeOverwrittenDetector localChangesDetector,
                            @NotNull GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector,
                            @NotNull GitRepository repository,
                            @NotNull GitRevisionNumber currentRev,
                            @NotNull Label beforeLabel,
                            @Nullable GitUpdatedRanges updatedRanges,
                            boolean commitAfterMerge) {
    VirtualFile root = repository.getRoot();

    if (mergeConflictDetector.hasHappened()) {
      new GitConflictResolver(project, singletonList(root), new GitConflictResolver.Params(project)) {
        @Override
        protected boolean proceedAfterAllMerged() throws VcsException {
          if (commitAfterMerge) {
            new GitMerger(project).mergeCommit(root);
          }
          return true;
        }
      }.merge();
    }

    if (result.success() || mergeConflictDetector.hasHappened()) {
      GitUtil.refreshVfsInRoot(root);
      repository.update();
      if (updatedRanges != null &&
          AbstractCommonUpdateAction.showsCustomNotification(singletonList(GitVcs.getInstance(project))) &&
          commitAfterMerge) {
        Map<GitRepository, HashRange> ranges = updatedRanges.calcCurrentPositions();
        GitUpdateInfoAsLog.NotificationData notificationData = new GitUpdateInfoAsLog(project, ranges).calculateDataAndCreateLogTab();

        Notification notification;
        if (notificationData != null) {
          String title = getTitleForUpdateNotification(notificationData.getUpdatedFilesCount(), notificationData.getReceivedCommitsCount());
          String content = getBodyForUpdateNotification(notificationData.getFilteredCommitsCount());
          notification = VcsNotifier.standardNotification()
            .createNotification(title, content, INFORMATION)
            .setDisplayId(GitNotificationIdsHolder.FILES_UPDATED_AFTER_MERGE)
            .addAction(NotificationAction.createSimple(GitBundle.message("action.NotificationAction.GitMergeAction.text.view.commits"), notificationData.getViewCommitAction()));
        }
        else {
          notification = VcsNotifier.standardNotification()
            .createNotification(VcsBundle.message("message.text.all.files.are.up.to.date"), INFORMATION)
            .setDisplayId(GitNotificationIdsHolder.FILES_UP_TO_DATE);
        }
        VcsNotifier.getInstance(project).notify(notification);
      }
      else {
        showUpdates(project, repository, currentRev, beforeLabel, getActionName());
      }
    }
    else if (localChangesDetector.wasMessageDetected()) {
      LocalChangesWouldBeOverwrittenHelper.showErrorNotification(project, LOCAL_CHANGES_DETECTED, repository.getRoot(), getActionName(),
                                                                 localChangesDetector.getRelativeFilePaths());
    }
    else if (untrackedFilesDetector.wasMessageDetected()) {
      GitUntrackedFilesHelper.notifyUntrackedFilesOverwrittenBy(project, root, untrackedFilesDetector.getRelativeFilePaths(),
                                                                getActionName(), null);
    }
    else {
      VcsNotifier.getInstance(project)
        .notifyError(getNotificationErrorDisplayId(),
                     GitBundle.message("merge.action.operation.failed", getActionName()),
                     result.getErrorOutputAsHtmlString());
      repository.update();
    }
  }
private void handleResult(@NotNull GitCommandResult result,
                            @NotNull Project project,
                            @NotNull GitSimpleEventDetector mergeConflictDetector,
                            @NotNull GitLocalChangesWouldBeOverwrittenDetector localChangesDetector,
                            @NotNull GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector,
                            @NotNull GitRepository repository,
                            @NotNull GitRevisionNumber currentRev,
                            @NotNull Label beforeLabel,
                            @Nullable GitUpdatedRanges updatedRanges,
                            boolean commitAfterMerge)