From f9850fe961cdef3202985e529a94a666caef54fa Mon Sep 17 00:00:00 2001 From: Constantine Plotnikov Date: Wed, 4 Aug 2010 15:17:20 +0400 Subject: [PATCH] git4idea: Nested vcs roots is now a warning in git init action --- plugins/git4idea/src/git4idea/actions/GitInit.java | 14 ++++++++++---- .../src/git4idea/i18n/GitBundle.properties | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/git4idea/src/git4idea/actions/GitInit.java b/plugins/git4idea/src/git4idea/actions/GitInit.java index 8425137714ad..3b4aa8329427 100644 --- a/plugins/git4idea/src/git4idea/actions/GitInit.java +++ b/plugins/git4idea/src/git4idea/actions/GitInit.java @@ -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(); diff --git a/plugins/git4idea/src/git4idea/i18n/GitBundle.properties b/plugins/git4idea/src/git4idea/i18n/GitBundle.properties index 96a9bbff61dd..c23fe197a498 100644 --- a/plugins/git4idea/src/git4idea/i18n/GitBundle.properties +++ b/plugins/git4idea/src/git4idea/i18n/GitBundle.properties @@ -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=The selected directory {0} is already under git.
Are you sure that you want to create a new vcs root? +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)