Commit 94af581d authored by Tobias Hunger's avatar Tobias Hunger

Git: Make git show a bit more robust

Change-Id: I5d0dc3bb43753f7b2ac9c308944f327537547d76
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent bd1ee399
......@@ -76,7 +76,7 @@ protected:
// inside reload() (for synchronous reload)
// or later (for asynchronous reload)
virtual void reload() = 0;
void reloadFinished(bool success);
virtual void reloadFinished(bool success);
void setDiffFiles(const QList<FileData> &diffFileList,
const QString &baseDirectory = QString());
......
......@@ -355,6 +355,7 @@ public:
void reload() override;
void processOutput(const QString &output) override;
void reloadFinished(bool success) override;
private:
const QString m_id;
......@@ -376,16 +377,26 @@ void ShowController::processOutput(const QString &output)
QTC_ASSERT(m_state != Idle, return);
if (m_state == GettingDescription) {
setDescription(gitClient()->extendedShowDescription(m_directory, output));
} else if (m_state == GettingDiff) {
processDiff(output);
}
}
void ShowController::reloadFinished(bool success)
{
QTC_ASSERT(m_state != Idle, return);
if (m_state == GettingDescription && success) {
QStringList args;
args << QLatin1String("show") << QLatin1String("--format=format:") // omit header, already generated
<< QLatin1String(noColorOption) << QLatin1String(decorateOption) << m_id;
m_state = GettingDiff;
runCommand(QList<QStringList>() << addConfigurationArguments(args));
} else if (m_state == GettingDiff) {
m_state = Idle;
processDiff(output);
return;
}
m_state = Idle;
BaseController::reloadFinished(success);
}
///////////////////////////////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment