Commit 39d85f0a authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Fix remote branch comparing

parent e416f6d0
...@@ -185,7 +185,8 @@ void BranchesDialog::openDialog(GitUtils::RefType r) ...@@ -185,7 +185,8 @@ void BranchesDialog::openDialog(GitUtils::RefType r)
void BranchesDialog::slotReturnPressed() 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(); const auto itemType = (BranchesDialogModel::ItemType)m_proxyModel->data(m_treeView.currentIndex(), BranchesDialogModel::ItemTypeRole).toInt();
Q_ASSERT(itemType == BranchesDialogModel::BranchItem); Q_ASSERT(itemType == BranchesDialogModel::BranchItem);
......
...@@ -753,7 +753,12 @@ void GitWidget::branchCompareFiles(const QString &from, const QString &to) ...@@ -753,7 +753,12 @@ void GitWidget::branchCompareFiles(const QString &from, const QString &to)
} }
} }
auto filesWithNameStatus = GitUtils::parseDiffNameStatus(git.readAllStandardOutput()); const QByteArray diff = git.readAllStandardOutput();
if (diff.isEmpty()) {
return;
}
auto filesWithNameStatus = GitUtils::parseDiffNameStatus(diff);
if (filesWithNameStatus.isEmpty()) { if (filesWithNameStatus.isEmpty()) {
sendMessage(i18n("Failed to compare %1...%2", from, to), true); sendMessage(i18n("Failed to compare %1...%2", from, to), true);
return; return;
...@@ -814,7 +819,6 @@ void GitWidget::buildMenu() ...@@ -814,7 +819,6 @@ void GitWidget::buildMenu()
using GitUtils::RefType; using GitUtils::RefType;
bd.openDialog(static_cast<GitUtils::RefType>(RefType::Head | RefType::Remote)); bd.openDialog(static_cast<GitUtils::RefType>(RefType::Head | RefType::Remote));
QString branch = bd.branch(); QString branch = bd.branch();
branchCompareFiles(branch, QString()); 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