private static void runWithDefaultConfirmations(@NotNull Project project, boolean resetConfirmations, @NotNull Runnable task) {
    if (!resetConfirmations) {
      task.run();
    }
    else {
      ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
      VcsShowConfirmationOption addConfirmation = vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.ADD, null);
      VcsShowConfirmationOption deleteConfirmation = vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.REMOVE, null);

      VcsShowConfirmationOption.Value addConfirmationValue = addConfirmation.getValue();
      VcsShowConfirmationOption.Value deleteConfirmationValue = deleteConfirmation.getValue();
      addConfirmation.setValue(VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY);
      deleteConfirmation.setValue(VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY);
      try {
        task.run();
      }
      finally {
        addConfirmation.setValue(addConfirmationValue);
        deleteConfirmation.setValue(deleteConfirmationValue);
      }
    }
  }
private static void runWithDefaultConfirmations(@NotNull Project project, boolean resetConfirmations, @NotNull Runnable task)