Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path problems on Windows #3

Open
kylewanderson opened this issue Dec 8, 2023 · 13 comments
Open

Path problems on Windows #3

kylewanderson opened this issue Dec 8, 2023 · 13 comments

Comments

@kylewanderson
Copy link

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
Copy link

GitMurf commented Dec 19, 2023

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
Copy link
Owner

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
Copy link
Author

kylewanderson commented Dec 22, 2023

@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
Copy link

GitMurf commented Dec 28, 2023

@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
Copy link
Owner

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

@polarmutex
Copy link
Owner

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

@polarmutex
Copy link
Owner

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

@kylewanderson
Copy link
Author

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

@polarmutex
Copy link
Owner

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
Copy link

GitMurf commented Jul 20, 2024

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
Copy link
Author

kylewanderson commented Jul 25, 2024

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
Copy link

sho-87 commented Oct 2, 2024

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

@kylewanderson
Copy link
Author

Thank you @sho-87!

Yes, that configuration works for the telescope extension.

@polarmutex I am no longer getting path errors on windows. However, when I make a worktree selection from the telescope extension the directory doesn't update. I stay in the directory I was already in.

The worktree add command from the telescope extension seems to function. If I add a worktree it creates the new path and changes to that directory. I notice that the path will be relative, so if I am already in a worktree directory, and I add another worktree, It will be nested inside rather than at the root of the bare repo. I can change directory to the bare repo and then add to get around this, but it would be nice if worktrees were started from the root of the bare repo.

requiring git-worktree directly to change worktrees works so long as you are in the root of the bare repo. e.g .require("git-worktree").switch_worktree("main")

If I try to use it to switch worktrees from 'main' to 'develop' it doesn't work.

It's usable for now, but some fixes would be awesome!

Let me know if there are more scenarios you'd like me to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants