Commit 2103a4a9 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Git: Clear branches model when repository becomes empty



Change-Id: I78932b342de5e1b29c75ed921d4d6afddf4d51da
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 49bad127
......@@ -74,7 +74,7 @@ public:
bool isLeaf() const
{
return children.isEmpty();
return children.isEmpty() && parent && parent->parent;
}
bool isTag() const
......@@ -331,8 +331,12 @@ void BranchModel::clear()
bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage)
{
if (workingDirectory.isEmpty())
beginResetModel();
clear();
if (workingDirectory.isEmpty()) {
endResetModel();
return false;
}
m_currentSha = m_client->synchronousTopRevision(workingDirectory);
QStringList args;
......@@ -341,9 +345,6 @@ bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage
if (!m_client->synchronousForEachRefCmd(workingDirectory, args, &output, errorMessage))
VcsBase::VcsBaseOutputWindow::instance()->appendError(*errorMessage);
beginResetModel();
clear();
m_workingDirectory = workingDirectory;
const QStringList lines = output.split(QLatin1Char('\n'));
foreach (const QString &l, lines)
......
Supports Markdown
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