diff --git a/Command/Uninit.hs b/Command/Uninit.hs index 1e96e1e6f7..9698ed8200 100644 --- a/Command/Uninit.hs +++ b/Command/Uninit.hs @@ -34,10 +34,7 @@ start = do perform :: CommandPerform perform = do g <- Annex.gitRepo - gitPreCommitHookUnWrite g - liftIO $ gitAttributesUnWrite g - next $ return True gitPreCommitHookUnWrite :: Git.Repo -> Annex () @@ -50,11 +47,3 @@ gitPreCommitHookUnWrite repo = do else warning $ "pre-commit hook (" ++ hook ++ ") contents modified; not deleting." ++ " Edit it to remove call to git annex." - -gitAttributesUnWrite :: Git.Repo -> IO () -gitAttributesUnWrite repo = do - let attributes = Git.attributes repo - whenM (doesFileExist attributes) $ do - c <- readFileStrict attributes - safeWriteFile attributes $ unlines $ - filter (\l -> not $ l `elem` Command.Init.attrLines) $ lines c diff --git a/Upgrade/V2.hs b/Upgrade/V2.hs new file mode 100644 index 0000000000..deb231d529 --- /dev/null +++ b/Upgrade/V2.hs @@ -0,0 +1,48 @@ +{- git-annex v2 -> v2 upgrade support + - + - Copyright 2011 Joey Hess + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module Upgrade.V1 where + +import System.IO.Error (try) +import System.Directory +import Control.Monad.State (liftIO) +import Control.Monad (filterM, forM_, unless) +import System.Posix.Files +import System.FilePath +import Data.String.Utils +import System.Posix.Types +import Data.Maybe +import Data.Char + +import Types.Key +import Content +import Types +import Locations +import LocationLog +import qualified Annex +import qualified AnnexQueue +import qualified GitRepo as Git +import Backend +import Messages +import Version +import Utility +import qualified Command.Init + +{- Old .gitattributes contents, not needed anymore. -} +attrLines :: [String] +attrLines = + [ stateDir "*.log merge=union" + , stateDir "*/*/*.log merge=union" + ] + +gitAttributesUnWrite :: Git.Repo -> IO () +gitAttributesUnWrite repo = do + let attributes = Git.attributes repo + whenM (doesFileExist attributes) $ do + c <- readFileStrict attributes + safeWriteFile attributes $ unlines $ + filter (\l -> not $ l `elem` attrLines) $ lines c