aboutsummaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
Diffstat (limited to 'Annex')
-rw-r--r--Annex/AutoMerge.hs3
-rw-r--r--Annex/Content.hs8
-rw-r--r--Annex/Drop.hs3
-rw-r--r--Annex/Ingest.hs26
4 files changed, 25 insertions, 15 deletions
diff --git a/Annex/AutoMerge.hs b/Annex/AutoMerge.hs
index 462e87e09..162ea66bc 100644
--- a/Annex/AutoMerge.hs
+++ b/Annex/AutoMerge.hs
@@ -24,6 +24,7 @@ import qualified Git.Ref
import qualified Git
import qualified Git.Branch
import Git.Types (BlobType(..))
+import Git.FilePath
import Config
import Annex.ReplaceFile
import Annex.VariantFile
@@ -188,7 +189,7 @@ resolveMerge' unstagedmap (Just us) them u = do
writeFile dest (formatPointer key)
_ -> noop
stagePointerFile dest =<< hashPointerFile key
- Database.Keys.addAssociatedFile key dest
+ Database.Keys.addAssociatedFile key =<< inRepo (toTopFilePath dest)
{- Stage a graft of a directory or file from a branch.
-
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 2a8b295d3..9e8da49e9 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -65,6 +65,7 @@ import Utility.DataUnits
import Utility.CopyFile
import Utility.Metered
import Config
+import Git.FilePath
import Git.SharedRepository
import Annex.Perms
import Annex.Link
@@ -471,7 +472,9 @@ moveAnnex key src = withObjectLoc key storeobject storedirect
, modifyContent dest $ do
freezeContent src
liftIO $ moveFile src dest
- fs <- Database.Keys.getAssociatedFiles key
+ g <- Annex.gitRepo
+ fs <- map (`fromTopFilePath` g)
+ <$> Database.Keys.getAssociatedFiles key
unless (null fs) $ do
mapM_ (populatePointerFile key dest) fs
Database.Keys.storeInodeCaches key (dest:fs)
@@ -722,7 +725,8 @@ removeAnnex (ContentRemovalLock key) = withObjectLoc key remove removedirect
remove file = cleanObjectLoc key $ do
secureErase file
liftIO $ nukeFile file
- mapM_ (void . tryIO . resetpointer)
+ g <- Annex.gitRepo
+ mapM_ (\f -> void $ tryIO $ resetpointer $ fromTopFilePath f g)
=<< Database.Keys.getAssociatedFiles key
Database.Keys.removeInodeCaches key
Direct.removeInodeCache key
diff --git a/Annex/Drop.hs b/Annex/Drop.hs
index 7e494c374..f02f4f386 100644
--- a/Annex/Drop.hs
+++ b/Annex/Drop.hs
@@ -19,6 +19,7 @@ import Annex.Wanted
import Config
import Annex.Content.Direct
import qualified Database.Keys
+import Git.FilePath
import qualified Data.Set as S
import System.Log.Logger (debugM)
@@ -49,7 +50,7 @@ handleDropsFrom :: [UUID] -> [Remote] -> Reason -> Bool -> Key -> AssociatedFile
handleDropsFrom locs rs reason fromhere key afile preverified runner = do
l <- ifM isDirect
( associatedFilesRelative key
- , Database.Keys.getAssociatedFiles key
+ , mapM getTopFilePath <$> Database.Keys.getAssociatedFiles key
)
let fs = if null l then maybeToList afile else l
n <- getcopies fs
diff --git a/Annex/Ingest.hs b/Annex/Ingest.hs
index 3ab7566c8..73f8a39ca 100644
--- a/Annex/Ingest.hs
+++ b/Annex/Ingest.hs
@@ -37,6 +37,7 @@ import Utility.InodeCache
import Annex.ReplaceFile
import Utility.Tmp
import Utility.CopyFile
+import Git.FilePath
import Annex.InodeSentinal
#ifdef WITH_CLIBS
#ifndef __ANDROID__
@@ -186,15 +187,18 @@ finishIngestUnlocked key source = do
finishIngestUnlocked' :: Key -> KeySource -> Annex ()
finishIngestUnlocked' key source = do
- Database.Keys.addAssociatedFile key (keyFilename source)
+ Database.Keys.addAssociatedFile key =<< inRepo (toTopFilePath (keyFilename source))
populateAssociatedFiles key source
{- Copy to any other locations using the same key. -}
populateAssociatedFiles :: Key -> KeySource -> Annex ()
populateAssociatedFiles key source = do
- otherfs <- filter (/= keyFilename source) <$> Database.Keys.getAssociatedFiles key
obj <- calcRepo (gitAnnexLocation key)
- forM_ otherfs $
+ g <- Annex.gitRepo
+ ingestedf <- flip fromTopFilePath g
+ <$> inRepo (toTopFilePath (keyFilename source))
+ afs <- map (`fromTopFilePath` g) <$> Database.Keys.getAssociatedFiles key
+ forM_ (filter (/= ingestedf) afs) $
populatePointerFile key obj
cleanCruft :: KeySource -> Annex ()
@@ -206,16 +210,18 @@ cleanCruft source = when (contentLocation source /= keyFilename source) $
-- content. Clean up from that.
cleanOldKeys :: FilePath -> Key -> Annex ()
cleanOldKeys file newkey = do
+ g <- Annex.gitRepo
+ ingestedf <- flip fromTopFilePath g <$> inRepo (toTopFilePath file)
+ topf <- inRepo (toTopFilePath file)
oldkeys <- filter (/= newkey)
- <$> Database.Keys.getAssociatedKey file
- mapM_ go oldkeys
- where
- go key = do
+ <$> Database.Keys.getAssociatedKey topf
+ forM_ oldkeys $ \key -> do
obj <- calcRepo (gitAnnexLocation key)
caches <- Database.Keys.getInodeCaches key
unlessM (sameInodeCache obj caches) $ do
unlinkAnnex key
- fs <- filter (/= file)
+ fs <- filter (/= ingestedf)
+ . map (`fromTopFilePath` g)
<$> Database.Keys.getAssociatedFiles key
fs' <- filterM (`sameInodeCache` caches) fs
case fs' of
@@ -225,9 +231,7 @@ cleanOldKeys file newkey = do
(f:_) -> do
ic <- withTSDelta (liftIO . genInodeCache f)
void $ linkToAnnex key f ic
- _ -> lostcontent
- where
- lostcontent = logStatus key InfoMissing
+ _ -> logStatus key InfoMissing
{- On error, put the file back so it doesn't seem to have vanished.
- This can be called before or after the symlink is in place. -}