Fix branch name parsing: strip + prefix from worktree branches
This commit is contained in:
parent
b8218878c5
commit
6e8e2845a0
|
|
@ -1007,8 +1007,8 @@ QString GitPlusPlusView::selectedBranch() const
|
|||
if (!item)
|
||||
return {};
|
||||
QString text = item->text();
|
||||
// Remove leading "* " for current branch
|
||||
if (text.startsWith(QStringLiteral("* ")))
|
||||
// Remove leading "* " for current branch or "+ " for worktree branch
|
||||
if (text.startsWith(QStringLiteral("* ")) || text.startsWith(QStringLiteral("+ ")))
|
||||
text = text.mid(2);
|
||||
return text.trimmed();
|
||||
}
|
||||
|
|
@ -1220,6 +1220,8 @@ void GitPlusPlusView::onBranchFinished(int exitCode, QProcess::ExitStatus)
|
|||
if (branch.startsWith(QLatin1Char('*'))) {
|
||||
current = branch.mid(2);
|
||||
branch = branch.mid(2);
|
||||
} else if (branch.startsWith(QLatin1Char('+'))) {
|
||||
branch = branch.mid(2);
|
||||
}
|
||||
// Skip HEAD pointer in remotes
|
||||
if (branch.contains(QStringLiteral(" -> "))) continue;
|
||||
|
|
|
|||
Loading…
Reference in New Issue