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)
|
if (!item)
|
||||||
return {};
|
return {};
|
||||||
QString text = item->text();
|
QString text = item->text();
|
||||||
// Remove leading "* " for current branch
|
// Remove leading "* " for current branch or "+ " for worktree branch
|
||||||
if (text.startsWith(QStringLiteral("* ")))
|
if (text.startsWith(QStringLiteral("* ")) || text.startsWith(QStringLiteral("+ ")))
|
||||||
text = text.mid(2);
|
text = text.mid(2);
|
||||||
return text.trimmed();
|
return text.trimmed();
|
||||||
}
|
}
|
||||||
|
|
@ -1220,6 +1220,8 @@ void GitPlusPlusView::onBranchFinished(int exitCode, QProcess::ExitStatus)
|
||||||
if (branch.startsWith(QLatin1Char('*'))) {
|
if (branch.startsWith(QLatin1Char('*'))) {
|
||||||
current = branch.mid(2);
|
current = branch.mid(2);
|
||||||
branch = branch.mid(2);
|
branch = branch.mid(2);
|
||||||
|
} else if (branch.startsWith(QLatin1Char('+'))) {
|
||||||
|
branch = branch.mid(2);
|
||||||
}
|
}
|
||||||
// Skip HEAD pointer in remotes
|
// Skip HEAD pointer in remotes
|
||||||
if (branch.contains(QStringLiteral(" -> "))) continue;
|
if (branch.contains(QStringLiteral(" -> "))) continue;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue