From 2c911300c50040f17d314c5c0891c82ecab4bb88 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 4 Mar 2015 16:08:41 -0400 Subject: fixup annex link target calculation when submodules are used in filesystems not supporting symlinks --- Annex/Fixup.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Annex') diff --git a/Annex/Fixup.hs b/Annex/Fixup.hs index cda36461c..bb35454ee 100644 --- a/Annex/Fixup.hs +++ b/Annex/Fixup.hs @@ -60,12 +60,13 @@ fixupDirect r = return r - submodule is mounted. - - When the filesystem doesn't support symlinks, we cannot make .git - - into a symlink. In this case, we merely adjust the Repo so that + - into a symlink. But we don't need too, since the repo will use direct + - mode, In this case, we merely adjust the Repo so that - symlinks to objects that get checked in will be in the right form. -} fixupSubmodule :: Repo -> GitConfig -> IO Repo fixupSubmodule r@(Repo { location = l@(Local { worktree = Just w, gitdir = d }) }) c - | (".git" "modules") `isInfixOf` d = do + | needsSubmoduleFixup r = do when (coreSymlinks c) $ replacedotgit `catchNonAsync` \_e -> hPutStrLn stderr @@ -84,3 +85,8 @@ fixupSubmodule r@(Repo { location = l@(Local { worktree = Just w, gitdir = d }) maybe (error "unset core.worktree failed") (\_ -> return ()) =<< Git.Config.unset "core.worktree" r fixupSubmodule r _ = return r + +needsSubmoduleFixup :: Repo -> Bool +needsSubmoduleFixup (Repo { location = (Local { worktree = Just _, gitdir = d }) }) = + (".git" "modules") `isInfixOf` d +needsSubmoduleFixup _ = False -- cgit v1.2.3