From aeab5d9ab92d084a10102f1d20a54a6cd15edc5c Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 7 Jan 2014 11:39:28 +0200 Subject: [PATCH] Git: Trim change on ChangeSelectionDialog When a ref is copied from an external source (e.g. gerrit), it might includes a trailing whitespace. Change-Id: I61305af27959f457795afa37654e683622d38259 Reviewed-by: Petar Perisin --- src/plugins/git/changeselectiondialog.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp index 9d7b04b4f1e..d813f232851 100644 --- a/src/plugins/git/changeselectiondialog.cpp +++ b/src/plugins/git/changeselectiondialog.cpp @@ -88,7 +88,7 @@ ChangeSelectionDialog::~ChangeSelectionDialog() QString ChangeSelectionDialog::change() const { - return m_ui->changeNumberEdit->text(); + return m_ui->changeNumberEdit->text().trimmed(); } void ChangeSelectionDialog::selectCommitFromRecentHistory() @@ -210,14 +210,14 @@ void ChangeSelectionDialog::recalculateDetails() m_ui->workingDirectoryEdit->setPalette(palette); } - const QString change = m_ui->changeNumberEdit->text(); - if (change.isEmpty()) { + const QString ref = change(); + if (ref.isEmpty()) { m_ui->detailsText->setPlainText(QString()); return; } QStringList args; - args << QLatin1String("log") << QLatin1String("-n1") << change; + args << QLatin1String("log") << QLatin1String("-n1") << ref; m_process = new QProcess(this); m_process->setWorkingDirectory(workingDir);