NeogitOrg / neogit

An interactive and powerful Git interface for Neovim, inspired by Magit
MIT License
4.1k stars 241 forks source link

fix: process.lua error when we have a bare repo in the worktree list #1548

Closed SjB closed 2 weeks ago

SjB commented 2 weeks ago

When generating a list of worktrees using the 'git worktree list --porcelain' command, a bare worktree only has 2 lines, whereas all other worktrees have 3 lines. Since we don't need to switch to the bare repo, we can safely ignore it. The new listing function will look for a branch listing and only add that to the list of worktrees.

worktree /tmp/ws-nvim/.repos/neogit.git
bare

worktree /tmp/ws-nvim/neogit-bare-worktree-listing-error
HEAD 2b770465b79dfe60898983ddfc897cdf08cf9d34
branch refs/heads/fix-bare-worktree-listing-error

worktree /tmp/ws-nvim/neogit-master
HEAD bae3412ea9ac31292e14e9090dde7cb118cd52c1
branch refs/heads/master
CKolkey commented 2 weeks ago

Thanks!