-
Notifications
You must be signed in to change notification settings - Fork 513
Move internal state dir to 'common' subdir in git path. (Fixes bug with multiple worktrees) #222
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
base: master
Are you sure you want to change the base?
Conversation
|
Hope we have response from the maintainers |
|
@AGWA Any chance this can get reviewed and included? I'm starting to use more worktree based things myself and this needs to be fixed. |
|
I created a build here. https://github.com/maxisam/git-crypt/actions/runs/11787683064 It works great and also works with this #105 |
|
Any chance we can get this merged soon? |
|
I applied this patch, but still facing the same issue. Being unable to create a workree in an unlocked state. $ git worktree add newtree2
Preparing worktree (checking out 'newtree2')
git-crypt: Error: Unable to open key file - have you unlocked/initialized this repository yet?
error: external filter '"git-crypt" smudge' failed 1
error: external filter '"git-crypt" smudge' failed
fatal: .config/gh/.env: smudge filter git-crypt failed
$ uname -a
Linux nixos 6.6.76 #1-NixOS SMP PREEMPT_DYNAMIC Sat Feb 8 08:52:39 UTC 2025 x86_64 GNU/Linux
$ ls /nix/store | grep --ignore-case 'git-crypt-0.7.0$'
14xknggr1bqwqpcia8dqgjp4l4s8yi73-git-crypt-0.7.0 |
|
Oh, would be so nice to have it merged so we can run multiple Claude sessions on our project… |
|
I just sent this to @AGWA on email, hoping to get a review and merge :) |
This allows unlocked repos to work correctly with multiple worktrees.
When doing
git worktree add newtree2in an "unlocked" repo, I get the following output and creating the new worktree fails.By putting
stracein front of the smudge command in.git/config, I see:Git is calling the smudge command when checking out the new working tree, which then fails to find the key file because
git rev-parseuses a separate dir for each worktree. Hence theworktrees/newtree2in the path. The command fails because there is nogit-cryptdir in.git/worktrees/newtree2.git rev-parse --git-pathshould be used instead ofgit rev-parse --git-dir, based on https://git-scm.com/docs/git-worktree#_details :More importantly,
git-cryptshould be using thecommonsubdir of the git dir to store in-use keys, since those need to be shared across workdirs. https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-common