@Override
  public void initRepository(@NotNull Project project, @NotNull VirtualFile root, boolean addFilesToVcs) {
    ProgressManager.progress2(GitBundle.message("progress.title.creating.git.repository"));

    GitCommandResult result = Git.getInstance().init(project, root);
    if (!result.success()) {
      VcsNotifier.getInstance(project).notifyError(INIT_FAILED, GitBundle.message("action.Git.Init.error"),
                                                   result.getErrorOutputAsHtmlString(), true);
      return;
    }

    GitInit.configureVcsMappings(project, root);
    GitUtil.generateGitignoreFileIfNeeded(project, root);
    // make sure .idea/.gitignore is created before adding files
    project.getService(GitIgnoreInStoreDirGenerator.class).generateGitignoreInStoreDirIfNeededSync();

    if (addFilesToVcs) {
      StoreUtil.saveSettings(project, true); // ensure vcs.xml is up-to-date

      try {
        GitFileUtils.addFiles(project, root, Collections.singletonList(root));
        VcsDirtyScopeManager.getInstance(project).dirDirtyRecursively(root);
      }
      catch (VcsException e) {
        VcsNotifier.getInstance(project).notifyError(INIT_STAGE_FAILED, GitBundle.message("action.Git.Init.Stage.error"),
                                                     result.getErrorOutputAsHtmlString(), true);
      }
    }
  }
@Override
  public void initRepository(@NotNull Project project, @NotNull VirtualFile root, boolean addFilesToVcs)