@@ -1273,10 +1273,11 @@ end
---@return table[] array of {path: string, branch?: string, bare?: boolean, detached?: boolean}
local function parse_worktree_list(output)
local worktrees = {}
+ ---@type {path: string, branch?: string, bare?: boolean, detached?: boolean, head?: string}|nil
local current = nil
for line in output:gmatch("[^\n]+") do
local key, value = line:match("^(%S+)%s*(.*)$")
- if key == "worktree" then
+ if key == "worktree" and value then
if current then
table.insert(worktrees, current)
end
@@ -1769,6 +1770,8 @@ local function main()
os.exit(EXIT_SUCCESS)
end
+ ---@cast command string
+
-- Collect remaining args
local subargs = {}
for i = 2, #arg do
@@ -1269,10 +1269,11 @@ end
---@return table[] array of {path: string, branch?: string, bare?: boolean, detached?: boolean}
local function parse_worktree_list(output)
local worktrees = {}
+ ---@type {path: string, branch?: string, bare?: boolean, detached?: boolean, head?: string}|nil
local current = nil
for line in output:gmatch("[^\n]+") do
local key, value = line:match("^(%S+)%s*(.*)$")
- if key == "worktree" then
+ if key == "worktree" and value then
if current then
table.insert(worktrees, current)
end
@@ -1765,6 +1766,8 @@ local function main()
os.exit(EXIT_SUCCESS)
end
+ ---@cast command string
+
-- Collect remaining args
local subargs = {}
for i = 2, #arg do