forked from qt-creator/qt-creator
Git: Clear branches model when repository becomes empty
Change-Id: I78932b342de5e1b29c75ed921d4d6afddf4d51da Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
49bad12787
commit
2103a4a96c
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user