Return Git root, not Git repository folder

Follow-up to e6c8b18, which works incorrectly e.g. for worktrees.
The issue found in IDEA-CR-21166
This commit is contained in:
Kirill Likhodedov
2017-06-05 19:31:02 +03:00
parent 358409aa28
commit ca188f4863
+3 -2
View File
@@ -368,8 +368,9 @@ public class GitUtil {
public static VirtualFile getGitRootOrNull(@NotNull final FilePath filePath) {
File root = filePath.getIOFile();
while (root != null) {
File gitDir = findGitDir(root);
if (gitDir != null) return LocalFileSystem.getInstance().findFileByIoFile(root);
if (isGitRoot(root)) {
return LocalFileSystem.getInstance().findFileByIoFile(root);
}
root = root.getParentFile();
}
return null;