Skip to content
Snippets Groups Projects
Commit 7c36f472 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Git: Fix stash names

Fix detection of stash names.

Task-number: QTCREATORBUG-2934
parent 9dd9475e
No related branches found
No related tags found
No related merge requests found
...@@ -67,20 +67,14 @@ bool Stash::parseStashLine(const QString &l) ...@@ -67,20 +67,14 @@ bool Stash::parseStashLine(const QString &l)
const int messagePos = l.indexOf(colon, branchPos + 1); const int messagePos = l.indexOf(colon, branchPos + 1);
if (messagePos < 0) if (messagePos < 0)
return false; return false;
// Name
const QString newName = l.left(branchPos);
// Branch spec // Branch spec
const QString branchSpec = l.mid(branchPos + 1, messagePos - branchPos - 1); const int onIndex = l.indexOf(QLatin1String("on "), branchPos + 2, Qt::CaseInsensitive);
const bool emptyMessage = branchSpec.contains(QLatin1String("WIP")); // "Work in Progress or sth" if (onIndex == -1 || onIndex >= messagePos)
const int onIndex = branchSpec.indexOf(QLatin1String("on "), 0, Qt::CaseInsensitive);
if (onIndex == -1)
return false; return false;
const QString newBranch = branchSpec.mid(onIndex + 3);
// Happy! // Happy!
name = newName; name = l.left(branchPos);
branch = newBranch; branch = l.mid(onIndex + 3, messagePos - onIndex - 3);
if (!emptyMessage) message = l.mid(messagePos + 2); // skip blank
message = l.mid(messagePos + 2); // skip blank
return true; return true;
} }
......
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