extend gitAnnexLink special case for worktrees

Fix symlinks generated to annexed content when in adjusted unlocked branch in a
linked worktree on a filesystem not supporting symlinks.

Before this fix, the symlink generated by eg git-annex sync in an adjusted
unlocked branch contained ".git/worktrees/". There was a special case
for the similar problem with submodules, so just use it to handle this case as
well. To detect this case, rely on fixupUnusualRepos setting mainWorkTreePath.
This commit is contained in:
Joey Hess 2025-07-14 14:43:43 -04:00
parent 9cdcbedf2d
commit aded5f9b7f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 6 additions and 4 deletions

View file

@ -270,10 +270,10 @@ gitAnnexLink file key r config = do
toInternalGitPath <$> relPathDirToFile (parentDir absfile) loc
where
getgitdir currdir
{- This special case is for git submodules on filesystems not
- supporting symlinks; generate link target that will
- work portably. -}
| not (coreSymlinks config) && needsSubmoduleFixup r =
{- This special case is for git submodules and worktrees
- on filesystems not supporting symlinks; generate link
- target that will work portably. -}
| not (coreSymlinks config) && (needsSubmoduleFixup r || isJust (Git.mainWorkTreePath r)) =
absNormPathUnix currdir (Git.repoPath r </> literalOsPath ".git")
| otherwise = Git.localGitDir r
absNormPathUnix d p = toInternalGitPath $

View file

@ -6,6 +6,8 @@ git-annex (10.20250631) UNRELEASED; urgency=medium
symlinks, that caused annexed file content to be stored in the wrong
location inside the git directory, and also caused pointer files to not
get populated.
* Fix symlinks generated to annexed content when in adjusted unlocked
branch in a linked worktree on a filesystem not supporting symlinks.
-- Joey Hess <id@joeyh.name> Mon, 07 Jul 2025 15:59:42 -0400