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
|
withKeysReferencedInGitRef a ref = do
|
||||||
showAction $ "checking " ++ Git.Ref.describe ref
|
showAction $ "checking " ++ Git.Ref.describe ref
|
||||||
(ts, clean) <- inRepo $ DiffTree.diffIndex ref
|
(ts, clean) <- inRepo $ DiffTree.diffIndex ref
|
||||||
-- if 'dstsha' is 0{40}, the key will be Nothing
|
forM_ ts $ \t ->
|
||||||
forM_ ts $ catObject . DiffTree.dstsha >=>
|
mapM_ (`process` t) [DiffTree.dstsha, DiffTree.srcsha]
|
||||||
encodeW8 . L.unpack *>=>
|
|
||||||
fileKey . takeFileName *>=>
|
|
||||||
maybe noop a
|
|
||||||
liftIO $ void clean
|
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
|
{- 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.
|
- of those that might still have value, or might be stale and removable.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue