unused: No longer shows as unused tmp files that are actively being transferred.

This commit is contained in:
Joey Hess 2013-07-25 19:51:08 -04:00
parent 822918089e
commit c6100aa5cc
2 changed files with 13 additions and 5 deletions

View file

@ -23,6 +23,7 @@ import Logs.Unused
import Annex.Content import Annex.Content
import Utility.FileMode import Utility.FileMode
import Logs.Location import Logs.Location
import Logs.Transfer
import qualified Annex import qualified Annex
import qualified Git import qualified Git
import qualified Git.Command import qualified Git.Command
@ -61,8 +62,8 @@ start = do
checkUnused :: CommandPerform checkUnused :: CommandPerform
checkUnused = chain 0 checkUnused = chain 0
[ check "" unusedMsg $ findunused =<< Annex.getState Annex.fast [ check "" unusedMsg $ findunused =<< Annex.getState Annex.fast
, check "bad" staleBadMsg $ staleKeysPrune gitAnnexBadDir , check "bad" staleBadMsg $ staleKeysPrune gitAnnexBadDir False
, check "tmp" staleTmpMsg $ staleKeysPrune gitAnnexTmpDir , check "tmp" staleTmpMsg $ staleKeysPrune gitAnnexTmpDir True
] ]
where where
findunused True = do findunused True = do
@ -289,8 +290,8 @@ withKeysReferencedInGitRef a ref = do
- -
- Also, stale keys that can be proven to have no value are deleted. - Also, stale keys that can be proven to have no value are deleted.
-} -}
staleKeysPrune :: (Git.Repo -> FilePath) -> Annex [Key] staleKeysPrune :: (Git.Repo -> FilePath) -> Bool -> Annex [Key]
staleKeysPrune dirspec = do staleKeysPrune dirspec nottransferred = do
contents <- staleKeys dirspec contents <- staleKeys dirspec
dups <- filterM inAnnex contents dups <- filterM inAnnex contents
@ -299,7 +300,12 @@ staleKeysPrune dirspec = do
dir <- fromRepo dirspec dir <- fromRepo dirspec
liftIO $ forM_ dups $ \t -> removeFile $ dir </> keyFile t liftIO $ forM_ dups $ \t -> removeFile $ dir </> keyFile t
return stale if nottransferred
then do
inprogress <- S.fromList . map (transferKey . fst)
<$> getTransfers
return $ filter (`S.notMember` inprogress) stale
else return stale
staleKeys :: (Git.Repo -> FilePath) -> Annex [Key] staleKeys :: (Git.Repo -> FilePath) -> Annex [Key]
staleKeys dirspec = do staleKeys dirspec = do

2
debian/changelog vendored
View file

@ -13,6 +13,8 @@ git-annex (4.20130724) UNRELEASED; urgency=low
core.fsyncobjectfiles, to help prevent data loss when the drive is yanked. core.fsyncobjectfiles, to help prevent data loss when the drive is yanked.
* Always build with -threaded, to avoid a deadlock when communicating with * Always build with -threaded, to avoid a deadlock when communicating with
gpg. gpg.
* unused: No longer shows as unused tmp files that are actively being
transferred.
-- Joey Hess <joeyh@debian.org> Tue, 23 Jul 2013 12:39:48 -0400 -- Joey Hess <joeyh@debian.org> Tue, 23 Jul 2013 12:39:48 -0400