git-annex unused --from remote skips its git-remote-annex keys
This turns out to only be necessary is edge cases. Most of the time, git-annex unused --from remote doesn't see git-remote-annex keys at all, because it does not record a location log for them. On the other hand, git-annex unused does find them, since it does not rely on the location log. And that's good because they're a local cache that the user should be able to drop. If, however, the user ran git-annex unused and then git-annex move --unused --to remote, the keys would have a location log for that remote. Then git-annex unused --from remote would see them, and would consider them unused. Even when they are present on the special remote they belong to. And that risks losing data if they drop the keys from the special remote, but didn't expect it would delete git branches they had pushed to it. So, make git-annex unused --from skip git-remote-annex keys whose uuid is the same as the remote.
This commit is contained in:
parent
0bf72ef103
commit
24af51e66d
4 changed files with 37 additions and 9 deletions
|
@ -1,6 +1,6 @@
|
|||
{- git-annex command
|
||||
-
|
||||
- Copyright 2010-2016 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2010-2024 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
@ -34,6 +34,7 @@ import Logs.View (is_branchView)
|
|||
import Annex.BloomFilter
|
||||
import qualified Database.Keys
|
||||
import Annex.InodeSentinal
|
||||
import Backend.GitRemoteAnnex (isGitRemoteAnnexKey)
|
||||
|
||||
import qualified Data.Map as M
|
||||
import qualified Data.ByteString as S
|
||||
|
@ -104,7 +105,8 @@ checkRemoteUnused remotename refspec = go =<< Remote.nameToUUID remotename
|
|||
_ <- check "" (remoteUnusedMsg r remotename) (remoteunused u) 0
|
||||
next $ return True
|
||||
remoteunused u = loggedKeysFor u >>= \case
|
||||
Just ks -> excludeReferenced refspec ks
|
||||
Just ks -> filter (not . isGitRemoteAnnexKey u)
|
||||
<$> excludeReferenced refspec ks
|
||||
Nothing -> giveup "This repository is read-only."
|
||||
|
||||
check :: String -> ([(Int, Key)] -> String) -> Annex [Key] -> Int -> Annex Int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue