Support Git Worktree
First of all, thank you for this tool, it's exactly what I was looking for
Unfortunately, I'm stuck on a specific case
I have my dotfiles with my nixos configuration for my main machine
Which are symlinked to /etc/nixos
But I also work / test the configuration of another machine
I use git worktree to have one repository but several work trees
Which seems not to be supported, can you add support for separate working tree, please?
From this separate working tree :
When i do pushnix deploy pi3bw i get
not a git repository
I tried to hack the code, but I never wrote any Go program
I found that the Go Git library already seems to have the function to detect the Git directory :
- https://pkg.go.dev/github.com/go-git/go-git/[email protected]#PlainOpenWithOptions
- https://pkg.go.dev/github.com/go-git/go-git/[email protected]#PlainOpenOptions
So I used the library to detect the Git directory, but pushnix deploy pi3bw does that:
remote not found
I'm stuck at this point
Here is a simplified version of my setup
cd /tmp
# dotfiles with my nixos configuration for my main machine
mkdir dotfiles
cd dotfiles
git init
git commit --allow-empty --message "initial commit"
# symlink to /etc/nixos
sudo mv /etc/nixos /etc/nixos.backup
sudo ln -s $(realpath .) /etc/nixos
# the remote used by pushnix
git remote add pi3bw [email protected]:dotfiles
# separate working tree for the other machine
git worktree add ../dotfiles_testing
Current behavior :
cd /tmp
cd dotfiles
# using pushnix from here works as expected
pushnix push pi3bw
# => Pushing configuration to remote pi3bw...
# Everything up-to-date
cd ../dotfiles_testing
# with the current's version
pushnix deploy pi3bw
# not a git repository
pushnix deploy pi3bw
# with my hacked's version
# remote not found