altsem / gitu

A TUI Git client inspired by Magit
MIT License
1.7k stars 88 forks source link

Support worktrees #64

Closed frank-lenormand closed 4 months ago

frank-lenormand commented 4 months ago

Hi,

It’d be nice if Gitu supported worktrees.

Currently, running it in one yield the following error:

$ gitu    
Error: Os { code: 20, kind: NotADirectory, message: "Not a directory" }

In a worktree, .git is a file that contains the path to the parent repository.

altsem commented 4 months ago

@frank-lenormand Which version are you on? Thought I fixed this crash with 0.5.5. Ah didn't realize it contains a path, that means rebase/merge status would be broken even after 0.5.5.

frank-lenormand commented 4 months ago

I installed the latest at the time, which is v0.6.3.

In the worktree directory in which I noticed the issue, the .git file contains:

gitdir: /the/full/path/to/parent/repository
golden-expiriensu commented 4 months ago

I actually can't reproduce this with v0.9.0, I wonder what steps did you make to get the error? I've run the following commands:

  1. git worktree add ../gitu_wt/fix-worktrees
  2. cd ../gitu_wt/fix-worktree
  3. gitu And no errors after that, I also successfully made a commit to test things out
Screenshot 2567-03-23 at 20 25 13 Screenshot 2567-03-23 at 20 27 00
frank-lenormand commented 4 months ago

The bug was reported for v0.6.3.

It seems to be working as expected, now, with v0.9.1.

I couldn’t find which specific commit addressed the issue.