boolean (@NotNull Path rootDir) { Path dotGit = rootDir.resolve(DOT_GIT); BasicFileAttributes attributes; try { attributes = Files.readAttributes(dotGit, BasicFileAttributes.class); } catch (IOException ignore) { return false; } if (attributes.isDirectory()) { try { BasicFileAttributes headExists = Files.readAttributes(dotGit.resolve(HEAD_FILE), BasicFileAttributes.class); return headExists.isRegularFile(); } catch (IOException ignore) { return false; } } if (!attributes.isRegularFile()) { return false; } String content; try { content = DvcsUtil.tryOrThrow(() -> StringUtil.convertLineSeparators(Files.readString(dotGit)).trim(), dotGit); } catch (RepoStateException e) { LOG.error(e); return false; } String pathToDir = parsePathToRepository(content); if (pathToDir == null) return false; return findRealRepositoryDir(rootDir, pathToDir) != null; }