This commit is contained in:
Cameron 2024-07-12 23:48:10 +02:00
parent 4a4657ffaa
commit c73993c1c6
No known key found for this signature in database
GPG key ID: 7998CB3EA6CE5CBC

View file

@ -54,15 +54,22 @@ function M.list(opts)
if path then
local main = Path.new(path, ".git"):is_dir()
if not opts.include_main and main then
-- no-op
else
table.insert(worktrees, {
head = head, type = type, ref = ref, main = main, path = path
})
end
table.insert(worktrees, {
head = head,
type = type,
ref = ref,
main = main,
path = path,
})
end
end
if not opts.include_main then
worktrees = util.filter(worktrees, function(worktree)
if not worktree.main then
return worktree
end
end)
end
return worktrees