Skip to content

Git branch listing doesn't work with git worktree #811

Closed
@marekmicek

Description

@marekmicek

The branch that has been setup as a separate worktree https://git-scm.com/docs/git-worktree has an initial + character which is currently not parsed.

diff --git a/node_modules/simple-git/dist/cjs/index.js b/node_modules/simple-git/dist/cjs/index.js
index 9ac9c57..0ffa221 100644
--- a/node_modules/simple-git/dist/cjs/index.js
+++ b/node_modules/simple-git/dist/cjs/index.js
@@ -3011,11 +3011,11 @@ var init_parse_branch = __esm({
     init_BranchSummary();
     init_utils();
     parsers8 = [
-      new LineParser(/^(\*\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => {
-        result.push(!!current, true, name, commit, label);
+      new LineParser(/^([\*\+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => {
+        result.push(current && current[0] === '*', true, name, commit, label);
       }),
-      new LineParser(/^(\*\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s, (result, [current, name, commit, label]) => {
-        result.push(!!current, false, name, commit, label);
+      new LineParser(/^([\*\+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s, (result, [current, name, commit, label]) => {
+        result.push(current && current[0] === '*', false, name, commit, label);
       })
     ];
   }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions