Git: Fix return value of BranchModel::refresh

Return false if for-each-ref fails, and true if not applicable (this is not
an error).

Fixes: QTCREATORBUG-21189
Change-Id: I895046f8c15c30abeddaa8b4231fb4bd46c343ef
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Orgad Shaneh
2018-09-27 21:12:52 +03:00
committed by Orgad Shaneh
parent 8b93eee3b1
commit b3e2c580f2

View File

@@ -341,15 +341,17 @@ bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage
clear();
if (workingDirectory.isEmpty()) {
endResetModel();
return false;
return true;
}
m_currentSha = m_client->synchronousTopRevision(workingDirectory);
const QStringList args = {"--format=%(objectname)\t%(refname)\t%(upstream:short)\t"
"%(*objectname)\t%(committerdate:raw)\t%(*committerdate:raw)"};
QString output;
if (!m_client->synchronousForEachRefCmd(workingDirectory, args, &output, errorMessage))
VcsOutputWindow::appendError(*errorMessage);
if (!m_client->synchronousForEachRefCmd(workingDirectory, args, &output, errorMessage)) {
endResetModel();
return false;
}
m_workingDirectory = workingDirectory;
const QStringList lines = output.split('\n');