| 84 | } |
| 85 | |
| 86 | std::optional<QString> getRepoBasePath(const QString &repo) |
| 87 | { |
| 88 | /* This call is intentionally blocking because we need git path for everything else */ |
| 89 | QProcess git; |
| 90 | if (!setupGitProcess(git, repo, {QStringLiteral("rev-parse"), QStringLiteral("--show-toplevel")})) { |
| 91 | return std::nullopt; |
| 92 | } |
| 93 | |
| 94 | startHostProcess(git, QProcess::ReadOnly); |
| 95 | if (git.waitForStarted() && git.waitForFinished(-1)) { |
| 96 | if (git.exitStatus() != QProcess::NormalExit || git.exitCode() != 0) { |
| 97 | return std::nullopt; |
| 98 | } |
| 99 | QString dotGitPath = QString::fromUtf8(git.readAllStandardOutput().trimmed()); |
| 100 | if (!dotGitPath.endsWith(u'/')) { |
| 101 | dotGitPath.append(u'/'); |
| 102 | } |
| 103 | return dotGitPath; |
| 104 | } |
| 105 | return std::nullopt; |
| 106 | } |
| 107 | |
| 108 | std::optional<QString> repoIndexFile(const QString &repo) |
| 109 | { |
no test coverage detected