polarmutex / git-worktree.nvim

MIT License
54 stars 14 forks source link

Path problems on Windows #3

Open kylewanderson opened 10 months ago

kylewanderson commented 10 months ago

When I add a worktree via this command in a windows environment: :lua require('telescope').extensions.git_worktree.git_worktrees()

I get the following error: Error executing luv callback: ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:271: Path must be valid: C:\Users\me\develop\bare-repo\C:/Users/me/develop/bare-repo\branch-name stack traceback: [C]: in function 'expand' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:271: in function '_create_uv_options' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:396: in function '_execute' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:448: in function 'start' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:578: in function 'v' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:244: in function '_shutdown' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:47: in function <...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:38>

It appears to successfully create the worktree however. I can see it when I use the workrees command: :lua require('telescope').extensions.git_worktree.create_git_worktree()

However, when I try to change worktrees by selecting one from the telescope prompt, I get a different pathing error:

Error executing luv callback: ...-data/lazy/git-worktree.nvim/lua/git-worktree/status.lua:63: 1 / 2: worktree does not exists, please create it first C:/Users/me/develop/bare-repo/branch-name stack traceback: [C]: in function 'error' ...-data/lazy/git-worktree.nvim/lua/git-worktree/status.lua:63: in function 'error' ...im-data/lazy/git-worktree.nvim/lua/git-worktree/init.lua:416: in function 'cb' ...im-data/lazy/git-worktree.nvim/lua/git-worktree/init.lua:230: in function 'v' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:244: in function '_shutdown' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:47: in function <...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:38>

The directory is present, and I can manually navigate there, and git knows I'm in the corresponding branch. It appears both issues are related to paths not functioning as expected. Any help would be greatly appreciated.

Thanks!

GitMurf commented 9 months ago

I am also having issues on Windows. @polarmutex thank you for making this fork. I just wanted to confirm you still plan on maintaining and creating a v2? Thanks so much!

polarmutex commented 9 months ago

yes, I have started v2 as a branch in this repo. It is on the backlog for a bit since I am enjoying the advent of code. But going to get back to it soon.

I am not a Windows user, but hopefully run tests on Windows to catch any errors. I can try to look into this on main if I get some time

kylewanderson commented 9 months ago

@polarmutex I poked around a bit trying to run tests. I'm not the most experienced in lua, I've mostly used it to configure neovim. I played around some but I wasn't able to get the tests to run. I'm happy to run them if I get some help to do so.

GitMurf commented 9 months ago

@polarmutex I see some action in your v2 branch 🎉 ;-) Is it too early to test that branch out? or is it not usable yet? Thanks for your hard work!

polarmutex commented 9 months ago

My goal is to have something usable by the end of the week

polarmutex commented 9 months ago

I will try to update #5 with current status, need to still add windows testing

polarmutex commented 2 months ago

Looking for testers of my v2 on Windows. I use plenary path for all path ops and should work.

kylewanderson commented 2 months ago

I can test it out. What lazy config should I use to pull in v2?

polarmutex commented 2 months ago

the current v2 code is in the main branch of this repo

so

{
  'polarmutex/git-worktree.nvim',
  version = '^2',
  dependencies = { "nvim-lua/plenary.nvim" }
}

should do it

GitMurf commented 2 months ago

Looking for testers of my v2 on Windows. I use plenary path for all path ops and should work.

I can test in a few days when I get home from vacation. Thanks for the nice work!

kylewanderson commented 2 months ago

Has the telescope plugin been removed/modified? I had been using the telescope extension to list and create worktrees.

Now when I execute the telescope extension command I get: E5108: Error executing lua [string ":lua"]:1: attempt to call field 'git_worktrees' (a nil value) stack traceback: [string ":lua"]:1: in main chunk

Here's my lazy config.

{
    'polarmutex/git-worktree.nvim',
    version = '^2',
    dependencies = { "nvim-lua/plenary.nvim" },
    config = function ()
      require('telescope').load_extension('git_worktree')
      vim.keymap.set('n', '<leader>gw', ":lua require('telescope').extensions.git_worktree.git_worktrees()<CR>", {silent = true})
      vim.keymap.set('n', '<leader>ga', ":lua require('telescope').extensions.git_worktree.create_git_worktree()<CR>", {silent = true})
    end
  }
sho-87 commented 1 day ago

had to dig through the src to find it, but the function has changed from git_worktrees() to git_worktree()