| 76 | { |
| 77 | |
| 78 | QDir dotGitDirectory(const QUrl& dirPath, bool silent = false) |
| 79 | { |
| 80 | const QFileInfo finfo(dirPath.toLocalFile()); |
| 81 | QDir dir = finfo.isDir() ? QDir(finfo.filePath()): finfo.absoluteDir(); |
| 82 | |
| 83 | const QString gitDir = QStringLiteral(".git"); |
| 84 | while (!dir.exists(gitDir) && dir.cdUp()) {} // cdUp, until there is a sub-directory called .git |
| 85 | |
| 86 | if (!silent && dir.isRoot()) { |
| 87 | qCWarning(PLUGIN_GIT) << "couldn't find the git root for" << dirPath; |
| 88 | } |
| 89 | |
| 90 | return dir; |
| 91 | } |
| 92 | |
| 93 | [[nodiscard]] QString gitHeadFile(const QUrl& dirPath) |
| 94 | { |
no test coverage detected