git4idea: Nested vcs roots is now a warning in git init action

This commit is contained in:
Constantine Plotnikov
2010-08-04 15:17:20 +04:00
parent a1f2b4a1ce
commit f9850fe961
2 changed files with 12 additions and 6 deletions
@@ -25,6 +25,7 @@ import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.VcsDirectoryMapping;
import com.intellij.openapi.vfs.VirtualFile;
@@ -65,9 +66,14 @@ public class GitInit extends DumbAwareAction {
}
final VirtualFile root = files[0];
if (GitUtil.isUnderGit(root)) {
Messages.showErrorDialog(project, GitBundle.message("init.error.already.under.git", root.getPresentableUrl()),
GitBundle.getString("init.error.title"));
return;
final int v = Messages.showYesNoDialog(project,
GitBundle.message("init.warning.already.under.git",
StringUtil.escapeXml(root.getPresentableUrl())),
GitBundle.getString("init.warning.title"),
Messages.getWarningIcon());
if (v != 0) {
return;
}
}
GitLineHandler h = new GitLineHandler(project, root, GitCommand.INIT);
h.setNoSSH(true);
@@ -82,7 +88,7 @@ public class GitInit extends DumbAwareAction {
return;
}
GitVcs.getInstance(project).runInBackground(new Task.Backgroundable(project, GitBundle.getString("common.refreshing")) {
public void run(@NotNull ProgressIndicator indicator) {
root.refresh(false, false);
final String path = root.equals(baseDir) ? "" : root.getPath();
@@ -147,8 +147,8 @@ init.add.root.message=Do you want to add this directory as vcs root?
init.add.root.title=Git Init
init.destination.directory.description=Select directory where the new Git repository will be created.
init.destination.directory.title=Select directory for git init
init.error.already.under.git=The selected directory {0} is already under git. The submodules are not yet supported.
init.error.title=git init Error
init.warning.already.under.git=<html>The selected directory <tt>{0}</tt> is already under git.<br/>Are you sure that you want to create a new vcs root?</html>
init.warning.title=Git Init
initializing.title=Initializing repository...
merge.action.name=Merge
merge.add.log.information.tooltip=Add log information to the commit message (\"--log\" option)