fix reversion in unused
The reversion was that, if a file was git rm'd, but still in branches, it would not be seen as used. Looking at both the added and the removed (or changed) files from the diff-index is a cheap way to fix that.
This commit is contained in:
parent
22d649d6e3
commit
88e2618e38
1 changed files with 8 additions and 5 deletions
|
@ -273,12 +273,15 @@ withKeysReferencedInGitRef :: (Key -> Annex ()) -> Git.Ref -> Annex ()
|
|||
withKeysReferencedInGitRef a ref = do
|
||||
showAction $ "checking " ++ Git.Ref.describe ref
|
||||
(ts, clean) <- inRepo $ DiffTree.diffIndex ref
|
||||
-- if 'dstsha' is 0{40}, the key will be Nothing
|
||||
forM_ ts $ catObject . DiffTree.dstsha >=>
|
||||
encodeW8 . L.unpack *>=>
|
||||
fileKey . takeFileName *>=>
|
||||
maybe noop a
|
||||
forM_ ts $ \t ->
|
||||
mapM_ (`process` t) [DiffTree.dstsha, DiffTree.srcsha]
|
||||
liftIO $ void clean
|
||||
where
|
||||
-- the key will be Nothing for the nullSha
|
||||
process getsha = catObject . getsha >=>
|
||||
encodeW8 . L.unpack *>=>
|
||||
fileKey . takeFileName *>=>
|
||||
maybe noop a
|
||||
|
||||
{- Looks in the specified directory for bad/tmp keys, and returns a list
|
||||
- of those that might still have value, or might be stale and removable.
|
||||
|
|
Loading…
Add table
Reference in a new issue