From aded5f9b7f4918f839a14e3d45ae095a7f82538f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Jul 2025 14:43:43 -0400 Subject: [PATCH] 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. --- Annex/Locations.hs | 8 ++++---- CHANGELOG | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) 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