Skip to content
Snippets Groups Projects
Commit 2ec4de7a authored by Tobias Hunger's avatar Tobias Hunger Committed by Robert Löhning
Browse files

Git: Fix thinko when trying to find merged branches

Fix thinko when trying to find out whether a branch was merged or not.

Change-Id: I6c4d600508af8a68fe0bac7e61f0b912c43cec32
Reviewed-on: http://codereview.qt.nokia.com/2200


Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarRobert Löhning <robert.loehning@nokia.com>
parent dd91cbcf
No related branches found
No related tags found
No related merge requests found
...@@ -470,15 +470,18 @@ bool BranchModel::branchIsMerged(const QModelIndex &idx) ...@@ -470,15 +470,18 @@ bool BranchModel::branchIsMerged(const QModelIndex &idx)
QString output; QString output;
QStringList args; QStringList args;
args << QLatin1String("--contains") << sha(idx); args << QLatin1String("-a") << QLatin1String("--contains") << sha(idx);
if (!m_client->synchronousBranchCmd(m_workingDirectory, args, &output, &errorMessage)) { if (!m_client->synchronousBranchCmd(m_workingDirectory, args, &output, &errorMessage)) {
VCSBase::VCSBaseOutputWindow::instance()->appendError(errorMessage); VCSBase::VCSBaseOutputWindow::instance()->appendError(errorMessage);
return false; return false;
} }
QStringList lines = output.split(QLatin1Char('/'), QString::SkipEmptyParts); QStringList lines = output.split(QLatin1Char('\n'), QString::SkipEmptyParts);
foreach (const QString &l, lines) { foreach (const QString &l, lines) {
if (l.startsWith(QLatin1String(" ")) && l.count() >= 3) QString currentBranch = l.mid(2); // remove first letters (those are either
// " " or "* " depending on whether it is
// the currently checked out branch or not)
if (currentBranch != branch)
return true; return true;
} }
return false; return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment