avoid importing Git into module used by Setup

That would have needed Setup-Depends to include unix and other
libraries.
This commit is contained in:
Joey Hess 2019-02-08 13:16:10 -04:00
parent 55a9a58e1e
commit 6cba1950f2
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 4 additions and 6 deletions

View file

@ -141,7 +141,7 @@ fixupUnusualRepos r@(Repo { location = l@(Local { worktree = Just w, gitdir = d
| coreSymlinks c = r { location = l { gitdir = dotgit } }
| otherwise = r
notnoannex = isNothing <$> noAnnexFileContent r
notnoannex = isNothing <$> noAnnexFileContent (repoWorkTree r)
fixupUnusualRepos r _ = return r
needsSubmoduleFixup :: Repo -> Bool

View file

@ -53,7 +53,7 @@ import qualified Utility.LockFile.Posix as Posix
#endif
checkCanInitialize :: Annex a -> Annex a
checkCanInitialize a = inRepo noAnnexFileContent >>= \case
checkCanInitialize a = inRepo (noAnnexFileContent . repoWorkTree) >>= \case
Nothing -> a
Just noannexmsg -> do
warning "Initialization prevented by .noannex file (remove the file to override)"

View file

@ -13,8 +13,6 @@ import Common
import Utility.Tmp
import Utility.FreeDesktop
import Git
{- ~/.config/git-annex/file -}
userConfigFile :: FilePath -> IO FilePath
userConfigFile file = do
@ -86,7 +84,7 @@ cannotFindProgram = do
{- A .noannex file in a git repository prevents git-annex from
- initializing that repository.. The content of the file is returned. -}
noAnnexFileContent :: Repo -> IO (Maybe String)
noAnnexFileContent r = case Git.repoWorkTree r of
noAnnexFileContent :: Maybe FilePath -> IO (Maybe String)
noAnnexFileContent repoworktree = case repoworktree of
Nothing -> return Nothing
Just wt -> catchMaybeIO (readFile (wt </> ".noannex"))