Move internal state dir to 'common' subdir in git path. (Fixes bug with multiple worktrees)#222
Open
morganwahl wants to merge 1 commit intoAGWA:masterfrom
Open
Move internal state dir to 'common' subdir in git path. (Fixes bug with multiple worktrees)#222morganwahl wants to merge 1 commit intoAGWA:masterfrom
morganwahl wants to merge 1 commit intoAGWA:masterfrom
Conversation
|
Hope we have response from the maintainers |
Contributor
|
@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. |
Qadeem411
approved these changes
May 18, 2024
alerque
approved these changes
May 18, 2024
maxisam
added a commit
to maxisam/git-crypt
that referenced
this pull request
Nov 11, 2024
|
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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