Skip to content

Getting error with telescope git_worktrees() #112

Open
@globule655

Description

@globule655

Hi there !
When using the command lua require('telescope').extensions.git_worktree.git_worktrees() I get the following error :

E5108: Error executing lua ...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:206: attempt to index field 'layout' (a nil value) stack traceback: ...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:206: in function 'calc_result_length' ...l/share/nvim/lazy/telescope.nvim/lua/telescope/utils.lua:265: in function 'transform_path' ...worktree.nvim/lua/telescope/_extensions/git_worktree.lua:166: in function 'parse_line' ...worktree.nvim/lua/telescope/_extensions/git_worktree.lua:179: in function 'git_worktrees' [string ":lua"]:1: in main chunk

The command lua require('telescope').extensions.git_worktree.create_git_worktree() works just fine.

Tried on windows wsl (ubuntu 22.04), neovim v0.9.2 Release.

Here is my config (kept it barebones).
Lazy plugins config:

{ "ThePrimeagen/git-worktree.nvim", config = function() require("telescope").load_extension("git_worktree") end, },

init.lua for mappings (give the same result as executing lua function in command mode) :

`vim.keymap.set("n", "gw", function ()
require('telescope').extensions.git_worktree.git_worktrees()
end,
{ desc = "Telescope switch & delete worktrees"})

vim.keymap.set("n", "gc", function ()
require('telescope').extensions.git_worktree.create_git_worktree()
end,
{ desc = "Telescope create worktree"})
`

Thank you very much for the help

EDIT:

I made the test under my home Linux laptop (Fedora 38) and the same thing happens.
Aslo tested under plain windows and there the Telescope window does open correctly. However, there is an error every time I try to switch to a worktree saying the directory doesn't exist.

When trying to create a worktree under windows via the telescope extension, the path looks like c:\users\globule\Documents\myawesomegitrepo\c:\users\globule\Documents\myawesomegitrepo\mybranch which leads to an error but it still creates the folder.
However, when trying to switch between workspaces created via the telescope extension, I get the error "The workspace doesn't exist, please create it first c:\users\globule\Documents\myawesomegitrepo"

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