diff options
author | Tobias Hunger <tobias.hunger@nokia.com> | 2010-10-29 14:18:08 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@nokia.com> | 2010-10-29 14:19:19 +0200 |
commit | 7c36f472770f69376dc0217429eeb7edefa384cb (patch) | |
tree | 326c8a83f763d45991a1feb343dfbf206c759750 /src/plugins/git | |
parent | 9dd9475e84eb73e987745d7b32282627ce46a57b (diff) | |
download | qt-creator-7c36f472770f69376dc0217429eeb7edefa384cb.tar.gz |
Git: Fix stash names
Fix detection of stash names.
Task-number: QTCREATORBUG-2934
Diffstat (limited to 'src/plugins/git')
-rw-r--r-- | src/plugins/git/gitutils.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/plugins/git/gitutils.cpp b/src/plugins/git/gitutils.cpp index 94418a0c60..a6d2f23381 100644 --- a/src/plugins/git/gitutils.cpp +++ b/src/plugins/git/gitutils.cpp @@ -67,20 +67,14 @@ bool Stash::parseStashLine(const QString &l) const int messagePos = l.indexOf(colon, branchPos + 1); if (messagePos < 0) return false; - // Name - const QString newName = l.left(branchPos); // Branch spec - const QString branchSpec = l.mid(branchPos + 1, messagePos - branchPos - 1); - const bool emptyMessage = branchSpec.contains(QLatin1String("WIP")); // "Work in Progress or sth" - const int onIndex = branchSpec.indexOf(QLatin1String("on "), 0, Qt::CaseInsensitive); - if (onIndex == -1) + const int onIndex = l.indexOf(QLatin1String("on "), branchPos + 2, Qt::CaseInsensitive); + if (onIndex == -1 || onIndex >= messagePos) return false; - const QString newBranch = branchSpec.mid(onIndex + 3); // Happy! - name = newName; - branch = newBranch; - if (!emptyMessage) - message = l.mid(messagePos + 2); // skip blank + name = l.left(branchPos); + branch = l.mid(onIndex + 3, messagePos - onIndex - 3); + message = l.mid(messagePos + 2); // skip blank return true; } |