diff options
author | Joey Hess <joey@kitenet.net> | 2014-02-26 16:52:56 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-02-26 16:52:56 -0400 |
commit | 8c6099d73c86f8803f08c47fe224cf8398cfd6c2 (patch) | |
tree | 7d23c487f323020f4c56a6957c58efe82e839570 /Annex | |
parent | b03b8e8cd7977d9a059efe8226b30e90f53be3e6 (diff) |
Put non-object tmp files in .git/annex/misctmp, leaving .git/annex/tmp for only partially transferred objects.
This allows eg, putting .git/annex/tmp on a ram disk, if the disk IO
of temp object files is too annoying (and if you don't want to keep
partially transferred objects across reboots).
.git/annex/misctmp must be on the same filesystem as the git work tree,
since files are moved to there in a way that will not work cross-device,
as well as symlinked into there.
I first wanted to put the tmp objects in .git/annex/objects/tmp, but
that would pose transition problems on upgrade when partially transferred
objects existed.
git annex info does not currently show the size of .git/annex/misctemp,
since it should stay small. It would also be ok to make something clean it
out, periodically.
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Content.hs | 4 | ||||
-rw-r--r-- | Annex/Init.hs | 4 | ||||
-rw-r--r-- | Annex/Journal.hs | 4 | ||||
-rw-r--r-- | Annex/ReplaceFile.hs | 4 |
4 files changed, 8 insertions, 8 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs index 45e8e9d47..740ed8bbc 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -221,7 +221,7 @@ getViaTmpChecked check key action = -} prepGetViaTmpChecked :: Key -> Annex Bool -> Annex Bool prepGetViaTmpChecked key getkey = do - tmp <- fromRepo $ gitAnnexTmpLocation key + tmp <- fromRepo $ gitAnnexTmpObjectLocation key e <- liftIO $ doesFileExist tmp alreadythere <- if e @@ -250,7 +250,7 @@ finishGetViaTmp check key action = do prepTmp :: Key -> Annex FilePath prepTmp key = do - tmp <- fromRepo $ gitAnnexTmpLocation key + tmp <- fromRepo $ gitAnnexTmpObjectLocation key createAnnexDirectory (parentDir tmp) return tmp diff --git a/Annex/Init.hs b/Annex/Init.hs index 43f24031c..57379535d 100644 --- a/Annex/Init.hs +++ b/Annex/Init.hs @@ -120,7 +120,7 @@ probeCrippledFileSystem = do #ifdef mingw32_HOST_OS return True #else - tmp <- fromRepo gitAnnexTmpDir + tmp <- fromRepo gitAnnexTmpMiscDir let f = tmp </> "gaprobe" createAnnexDirectory tmp liftIO $ writeFile f "" @@ -157,7 +157,7 @@ probeFifoSupport = do #ifdef mingw32_HOST_OS return False #else - tmp <- fromRepo gitAnnexTmpDir + tmp <- fromRepo gitAnnexTmpMiscDir let f = tmp </> "gaprobe" createAnnexDirectory tmp liftIO $ do diff --git a/Annex/Journal.hs b/Annex/Journal.hs index 3f31cb941..395e81d29 100644 --- a/Annex/Journal.hs +++ b/Annex/Journal.hs @@ -35,11 +35,11 @@ import Utility.WinLock -} setJournalFile :: JournalLocked -> FilePath -> String -> Annex () setJournalFile _jl file content = do + tmp <- fromRepo gitAnnexTmpMiscDir createAnnexDirectory =<< fromRepo gitAnnexJournalDir - createAnnexDirectory =<< fromRepo gitAnnexTmpDir + createAnnexDirectory tmp -- journal file is written atomically jfile <- fromRepo $ journalFile file - tmp <- fromRepo gitAnnexTmpDir let tmpfile = tmp </> takeFileName jfile liftIO $ do writeBinaryFile tmpfile content diff --git a/Annex/ReplaceFile.hs b/Annex/ReplaceFile.hs index dd93b471c..8b15f5ce3 100644 --- a/Annex/ReplaceFile.hs +++ b/Annex/ReplaceFile.hs @@ -24,7 +24,7 @@ import Annex.Exception -} replaceFile :: FilePath -> (FilePath -> Annex ()) -> Annex () replaceFile file a = do - tmpdir <- fromRepo gitAnnexTmpDir + tmpdir <- fromRepo gitAnnexTmpMiscDir void $ createAnnexDirectory tmpdir bracketIO (setup tmpdir) nukeFile $ \tmpfile -> do a tmpfile @@ -36,4 +36,4 @@ replaceFile file a = do return tmpfile fallback tmpfile _ = do createDirectoryIfMissing True $ parentDir file - rename tmpfile file + moveFile tmpfile file |