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.
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 $
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