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 Utility.FileMode
import Logs.Location
import Logs.Transfer
import qualified Annex
import qualified Git
import qualified Git.Command
@ -61,8 +62,8 @@ start = do
checkUnused :: CommandPerform
checkUnused = chain 0
[ check "" unusedMsg $ findunused =<< Annex.getState Annex.fast
, check "bad" staleBadMsg $ staleKeysPrune gitAnnexBadDir
, check "tmp" staleTmpMsg $ staleKeysPrune gitAnnexTmpDir
, check "bad" staleBadMsg $ staleKeysPrune gitAnnexBadDir False
, check "tmp" staleTmpMsg $ staleKeysPrune gitAnnexTmpDir True
]
where
findunused True = do
@ -289,8 +290,8 @@ withKeysReferencedInGitRef a ref = do
-
- Also, stale keys that can be proven to have no value are deleted.
-}
staleKeysPrune :: (Git.Repo -> FilePath) -> Annex [Key]
staleKeysPrune dirspec = do
staleKeysPrune :: (Git.Repo -> FilePath) -> Bool -> Annex [Key]
staleKeysPrune dirspec nottransferred = do
contents <- staleKeys dirspec
dups <- filterM inAnnex contents
@ -299,7 +300,12 @@ staleKeysPrune dirspec = do
dir <- fromRepo dirspec
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 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.
* Always build with -threaded, to avoid a deadlock when communicating with
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