From 169bf44357db5d28833ea4a74767e9eb5d6849a9 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 23 Dec 2014 16:00:05 +0300 Subject: [PATCH] [git] IDEA-81563 Correctly identify Git root for submodule changes When the submodule is changed in the super-project, the root of this change is this super-project, not the submodule root. In particular, this led to exception when trying to merge conflicts when one of conflicts was the submodule. --- plugins/git4idea/src/git4idea/GitUtil.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/GitUtil.java b/plugins/git4idea/src/git4idea/GitUtil.java index 9177f9d85312..19cc3bd36a1e 100644 --- a/plugins/git4idea/src/git4idea/GitUtil.java +++ b/plugins/git4idea/src/git4idea/GitUtil.java @@ -180,7 +180,8 @@ public class GitUtil { throws VcsException { Map> result = new HashMap>(); for (VirtualFile file : virtualFiles) { - final VirtualFile vcsRoot = gitRootOrNull(file); + // directory is reported only when it is a submodule => it should be treated in the context of super-root + final VirtualFile vcsRoot = gitRootOrNull(file.isDirectory() ? file.getParent() : file); if (vcsRoot == null) { if (ignoreNonGit) { continue;