From: Joey Hess Date: Mon, 14 Jul 2025 18:43:43 +0000 (-0400) Subject: extend gitAnnexLink special case for worktrees X-Git-Tag: archive/raspbian/10.20251029-1+rpi1~1^2~7^2~16 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=aded5f9b7f4918f839a14e3d45ae095a7f82538f;p=git-annex.git 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. --- diff --git a/Annex/Locations.hs b/Annex/Locations.hs index 8ea90af67c..b2929a2883 100644 --- a/Annex/Locations.hs +++ b/Annex/Locations.hs @@ -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 $ diff --git a/CHANGELOG b/CHANGELOG index 84e4759738..d85abaa2c1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 Mon, 07 Jul 2025 15:59:42 -0400