MCPcopy Create free account
hub / github.com/KDE/kate / getRepoBasePath

Function getRepoBasePath

apps/lib/gitprocess.cpp:86–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86std::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
108std::optional<QString> repoIndexFile(const QString &repo)
109{

Callers 5

showFileHistoryMethod · 0.85
openCommitMethod · 0.85
checkAndRefreshGitMethod · 0.85
setDotGitPathMethod · 0.85
locateCompileCommandsMethod · 0.85

Calls 3

setupGitProcessFunction · 0.85
startHostProcessFunction · 0.85
waitForFinishedMethod · 0.80

Tested by

no test coverage detected