diff --git a/Command.hs b/Command.hs index 228c1f40e9..129233d740 100644 --- a/Command.hs +++ b/Command.hs @@ -22,7 +22,6 @@ import qualified Backend import Messages import qualified Annex import qualified GitRepo as Git -import Locations import Utility import Types.Key @@ -181,17 +180,15 @@ withNothing _ _ = error "This command takes no parameters." backendPairs :: CommandSeekBackendFiles backendPairs a files = liftM (map a) $ Backend.chooseBackends files -{- Filter out files from the state directory, and those matching the - - exclude glob pattern, if it was specified. -} +{- Filter out files those matching the exclude glob pattern, + - if it was specified. -} filterFiles :: [FilePath] -> Annex [FilePath] filterFiles l = do - let l' = filter notState l exclude <- Annex.getState Annex.exclude if null exclude - then return l' - else return $ filter (notExcluded $ wildsRegex exclude) l' + then return l + else return $ filter (notExcluded $ wildsRegex exclude) l where - notState f = not $ stateDir `isPrefixOf` f notExcluded r f = isNothing $ match r f [] wildsRegex :: [String] -> Regex diff --git a/Locations.hs b/Locations.hs index 7f9626a11b..df4957f3e1 100644 --- a/Locations.hs +++ b/Locations.hs @@ -6,8 +6,6 @@ -} module Locations ( - gitStateDir, - stateDir, keyFile, fileKey, gitAnnexLocation, @@ -52,13 +50,6 @@ import qualified GitRepo as Git - Everything else should use relative paths. -} -{- Long-term, cross-repo state is stored in files inside the .git-annex - - directory, in the git repository's working tree. -} -stateDir :: FilePath -stateDir = addTrailingPathSeparator $ ".git-annex" -gitStateDir :: Git.Repo -> FilePath -gitStateDir repo = addTrailingPathSeparator $ Git.workTree repo stateDir - {- The directory git annex uses for local state, relative to the .git - directory -} annexDir :: FilePath diff --git a/Upgrade/V1.hs b/Upgrade/V1.hs index 61a8018590..b06f00d34d 100644 --- a/Upgrade/V1.hs +++ b/Upgrade/V1.hs @@ -113,7 +113,7 @@ moveLocationLogs = do where oldlocationlogs = do g <- Annex.gitRepo - let dir = gitStateDir g + let dir = Upgrade.V2.gitStateDir g exists <- liftIO $ doesDirectoryExist dir if exists then do @@ -123,7 +123,7 @@ moveLocationLogs = do move (l, k) = do g <- Annex.gitRepo let dest = logFile k - let dir = gitStateDir g + let dir = Upgrade.V2.gitStateDir g let f = dir l liftIO $ createDirectoryIfMissing True (parentDir dest) -- could just git mv, but this way deals with @@ -186,7 +186,7 @@ fileKey1 file = readKey1 $ replace "&a" "&" $ replace "&s" "%" $ replace "%" "/" file logFile1 :: Git.Repo -> Key -> String -logFile1 repo key = gitStateDir repo ++ keyFile1 key ++ ".log" +logFile1 repo key = Upgrade.V2.gitStateDir repo ++ keyFile1 key ++ ".log" lookupFile1 :: FilePath -> Annex (Maybe (Key, Backend Annex)) lookupFile1 file = do diff --git a/Upgrade/V2.hs b/Upgrade/V2.hs index 36ba1a0f21..7e4cfb13a7 100644 --- a/Upgrade/V2.hs +++ b/Upgrade/V2.hs @@ -89,3 +89,9 @@ gitAttributesUnWrite repo = do liftIO $ safeWriteFile attributes $ unlines $ filter (\l -> not $ l `elem` attrLines) $ lines c Git.run repo "add" [File attributes] + +stateDir :: FilePath +stateDir = addTrailingPathSeparator $ ".git-annex" +gitStateDir :: Git.Repo -> FilePath +gitStateDir repo = addTrailingPathSeparator $ Git.workTree repo stateDir + diff --git a/doc/upgrades.mdwn b/doc/upgrades.mdwn index bf12f7e438..63fbcf75b7 100644 --- a/doc/upgrades.mdwn +++ b/doc/upgrades.mdwn @@ -69,7 +69,6 @@ Example upgrade process: cd localrepo git pull git annex upgrade - (Upgrading object directory layout v1 to v2...) git commit -m "upgrade v1 to v2" git push