@@ -19,23 +19,26 @@ func TestFromPath(t *testing.T) {
1919
2020 t .Run ("name for git repo" , func (t * testing.T ) {
2121 mockPathwrap .On ("EvalSymlinks" , "/Users/josh/config/dotfiles/.config/neovim" ).Return ("/Users/josh/config/dotfiles/.config/neovim" , nil )
22- mockGit .On ("GitRoot" , "/Users/josh/config/dotfiles/.config/neovim" ).Return (true , "/Users/josh/config/dotfiles" , nil )
22+ mockGit .On ("ShowTopLevel" , "/Users/josh/config/dotfiles/.config/neovim" ).Return (true , "/Users/josh/config/dotfiles" , nil )
23+ // mockGit.On("GitCommonDir", "/Users/josh/config/dotfiles/.config/neovim").Return(true, "", nil)
2324 mockPathwrap .On ("Base" , "/Users/josh/config/dotfiles" ).Return ("dotfiles" )
2425 name , _ := n .Name ("/Users/josh/config/dotfiles/.config/neovim" )
2526 assert .Equal (t , "dotfiles/_config/neovim" , name )
2627 })
2728
2829 t .Run ("name for git worktree" , func (t * testing.T ) {
2930 mockPathwrap .On ("EvalSymlinks" , "/Users/josh/config/sesh/main" ).Return ("/Users/josh/config/sesh/main" , nil )
30- mockGit .On ("GitRoot" , "/Users/josh/config/sesh/main" ).Return (true , "/Users/josh/config/sesh" , nil )
31+ mockGit .On ("ShowTopLevel" , "/Users/josh/config/sesh/main" ).Return (true , "/Users/josh/config/sesh/main" , nil )
32+ // mockGit.On("GitCommonDir", "/Users/josh/config/sesh/main").Return(true, "/Users/josh/config/sesh/.bare", nil)
3133 mockPathwrap .On ("Base" , "/Users/josh/config/sesh" ).Return ("sesh" )
3234 name , _ := n .Name ("/Users/josh/config/sesh/main" )
3335 assert .Equal (t , "sesh/main" , name )
3436 })
3537
3638 t .Run ("returns base on non-git dir" , func (t * testing.T ) {
3739 mockPathwrap .On ("EvalSymlinks" , "/Users/josh/.config/neovim" ).Return ("/Users/josh/.config/neovim" , nil )
38- mockGit .On ("GitRoot" , "/Users/josh/.config/neovim" ).Return (false , "" , fmt .Errorf ("not a git repository (or any of the parent" ))
40+ mockGit .On ("ShowTopLevel" , "/Users/josh/.config/neovim" ).Return (false , "" , fmt .Errorf ("not a git repository (or any of the parent" ))
41+ // mockGit.On("GitCommonDir", "/Users/josh/.config/neovim").Return(false, "", fmt.Errorf("not a git repository (or any of the parent"))
3942 mockPathwrap .On ("Base" , "/Users/josh/.config/neovim" ).Return ("neovim" )
4043 name , _ := n .Name ("/Users/josh/.config/neovim" )
4144 assert .Equal (t , "neovim" , name )
@@ -50,23 +53,26 @@ func TestFromPath(t *testing.T) {
5053
5154 t .Run ("name for symlinked file in symlinked git repo" , func (t * testing.T ) {
5255 mockPathwrap .On ("EvalSymlinks" , "/Users/josh/d/.c/neovim" ).Return ("/Users/josh/dotfiles/.config/neovim" , nil )
53- mockGit .On ("GitRoot" , "/Users/josh/dotfiles/.config/neovim" ).Return (true , "/Users/josh/dotfiles" , nil )
56+ mockGit .On ("ShowTopLevel" , "/Users/josh/dotfiles/.config/neovim" ).Return (true , "/Users/josh/dotfiles" , nil )
57+ // mockGit.On("GitCommonDir", "/Users/josh/dotfiles/.config/neovim").Return(true, "", nil)
5458 mockPathwrap .On ("Base" , "/Users/josh/dotfiles" ).Return ("dotfiles" )
5559 name , _ := n .Name ("/Users/josh/d/.c/neovim" )
5660 assert .Equal (t , "dotfiles/_config/neovim" , name )
5761 })
5862
5963 t .Run ("name for git worktree" , func (t * testing.T ) {
6064 mockPathwrap .On ("EvalSymlinks" , "/Users/josh/p/sesh/main" ).Return ("/Users/josh/projects/sesh/main" , nil )
61- mockGit .On ("GitRoot" , "/Users/josh/projects/sesh/main" ).Return (true , "/Users/josh/projects/sesh" , nil )
65+ mockGit .On ("ShowTopLevel" , "/Users/josh/projects/sesh/main" ).Return (true , "/Users/josh/projects/sesh/main" , nil )
66+ // mockGit.On("GitCommonDir", "/Users/josh/projects/sesh/main").Return(true, "/Users/josh/projects/sesh/.bare", nil)
6267 mockPathwrap .On ("Base" , "/Users/josh/projects/sesh" ).Return ("sesh" )
6368 name , _ := n .Name ("/Users/josh/p/sesh/main" )
6469 assert .Equal (t , "sesh/main" , name )
6570 })
6671
6772 t .Run ("returns base on non-git dir" , func (t * testing.T ) {
6873 mockPathwrap .On ("EvalSymlinks" , "/Users/josh/c/neovim" ).Return ("/Users/josh/.config/neovim" , nil )
69- mockGit .On ("GitRoot" , "/Users/josh/.config/neovim" ).Return (false , "" , fmt .Errorf ("not a git repository (or any of the parent" ))
74+ mockGit .On ("ShowTopLevel" , "/Users/josh/.config/neovim" ).Return (false , "" , fmt .Errorf ("not a git repository (or any of the parent" ))
75+ // mockGit.On("GitCommonDir", "/Users/josh/.config/neovim").Return(false, "", fmt.Errorf("not a git repository (or any of the parent"))
7076 mockPathwrap .On ("Base" , "/Users/josh/.config/neovim" ).Return ("neovim" )
7177 name , _ := n .Name ("/Users/josh/c/neovim" )
7278 assert .Equal (t , "neovim" , name )
0 commit comments