summaryrefslogtreecommitdiff
path: root/Annex.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-13 00:42:46 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-13 00:42:46 -0400
commit208bba8d3062133733d27a5db521013e3a2ead57 (patch)
tree0a54c5cc7899329a13f995b57f32d25dceb17016 /Annex.hs
parent9926fe5c8a1479f734c0a5b68c7c4e6ddfc2f8cf (diff)
got rid of the .git-annex/key.backend files
Diffstat (limited to 'Annex.hs')
-rw-r--r--Annex.hs24
1 files changed, 11 insertions, 13 deletions
diff --git a/Annex.hs b/Annex.hs
index b8e70e6c8..82efd543d 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -25,8 +25,8 @@ import LocationLog
import Types
{- Checks if a given key is currently present in the annexLocation -}
-inAnnex :: State -> Key -> IO Bool
-inAnnex state key = doesFileExist $ annexLocation state key
+inAnnex :: State -> Backend -> Key -> IO Bool
+inAnnex state backend key = doesFileExist $ annexLocation state backend key
{- On startup, examine the git repo, prepare it, and record state for
- later. -}
@@ -56,15 +56,14 @@ annexFile state file = do
Just (key, backend) -> setup key backend
where
setup key backend = do
- let dest = annexLocation state key
+ let dest = annexLocation state backend key
createDirectoryIfMissing True (parentDir dest)
renameFile file dest
createSymbolicLink dest file
- gitRun (repo state) ["add", file, bfile]
+ gitRun (repo state) ["add", file]
gitRun (repo state) ["commit", "-m",
- ("git-annex annexed " ++ file), file, bfile]
+ ("git-annex annexed " ++ file), file]
logStatus state key ValuePresent
- where bfile = backendFile state backend file
checkLegal file = do
s <- getSymbolicLinkStatus file
if ((isSymbolicLink s) || (not $ isRegularFile s))
@@ -82,16 +81,15 @@ unannexFile state file = do
case (mkey) of
Nothing -> return ()
Just (key, backend) -> do
- let src = annexLocation state key
+ let src = annexLocation state backend key
removeFile file
- gitRun (repo state) ["rm", file, bfile]
+ gitRun (repo state) ["rm", file]
gitRun (repo state) ["commit", "-m",
("git-annex unannexed " ++ file),
- file, bfile]
+ file]
renameFile src file
logStatus state key ValueMissing
return ()
- where bfile = backendFile state backend file
{- Transfers the file from a remote. -}
annexGetFile :: State -> FilePath -> IO ()
@@ -100,12 +98,12 @@ annexGetFile state file = do
case (alreadyannexed) of
Nothing -> error $ "not annexed " ++ file
Just backend -> do
- key <- lookupKey state backend file
- inannex <- inAnnex state key
+ key <- fileKey file
+ inannex <- inAnnex state backend key
if (inannex)
then return ()
else do
- let dest = annexLocation state key
+ let dest = annexLocation state backend key
createDirectoryIfMissing True (parentDir dest)
success <- retrieveFile state file dest
if (success)