From 6e8e2845a07335ed4217f2fed8c0d0f1d90d42c6 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Thu, 23 Jul 2026 16:07:01 +0200 Subject: [PATCH] Fix branch name parsing: strip + prefix from worktree branches --- gitplusplus.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gitplusplus.cpp b/gitplusplus.cpp index 2f53153..f8a9730 100644 --- a/gitplusplus.cpp +++ b/gitplusplus.cpp @@ -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;