remove stateDir

This commit is contained in:
Joey Hess 2011-06-23 08:48:13 -04:00
parent af10b2854a
commit 9e37898e21
5 changed files with 13 additions and 20 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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