Commit 370d5787 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Fix remote branch comparing

parent 7bb6b9e0
......@@ -185,7 +185,8 @@ void BranchesDialog::openDialog(GitUtils::RefType r)
void BranchesDialog::slotReturnPressed()
{
const auto branch = m_proxyModel->data(m_treeView.currentIndex(), BranchesDialogModel::CheckoutName).toString();
/** We want display role here */
const auto branch = m_proxyModel->data(m_treeView.currentIndex(), Qt::DisplayRole).toString();
const auto itemType = (BranchesDialogModel::ItemType)m_proxyModel->data(m_treeView.currentIndex(), BranchesDialogModel::ItemTypeRole).toInt();
Q_ASSERT(itemType == BranchesDialogModel::BranchItem);
......
......@@ -753,7 +753,13 @@ void GitWidget::branchCompareFiles(const QString &from, const QString &to)
}
}
auto filesWithNameStatus = GitUtils::parseDiffNameStatus(git.readAllStandardOutput());
const QByteArray diff = git.readAllStandardOutput();
if (diff.isEmpty()) {
sendMessage(i18n("No diff for %1...%2", from, to), false);
return;
}
auto filesWithNameStatus = GitUtils::parseDiffNameStatus(diff);
if (filesWithNameStatus.isEmpty()) {
sendMessage(i18n("Failed to compare %1...%2", from, to), true);
return;
......@@ -814,7 +820,6 @@ void GitWidget::buildMenu()
using GitUtils::RefType;
bd.openDialog(static_cast<GitUtils::RefType>(RefType::Head | RefType::Remote));
QString branch = bd.branch();
branchCompareFiles(branch, QString());
});
......
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