rekey: No longer copies over urls from the old to the new key.

It makes sense for migrate to do that, but not for this low-level (and
little used) plumbing command to.
This commit is contained in:
Joey Hess 2016-01-07 18:06:20 -04:00
parent 2b781cbf7b
commit d6fe7fdd7d
Failed to extract signature
3 changed files with 11 additions and 9 deletions

View file

@ -18,6 +18,8 @@ import qualified Command.ReKey
import qualified Command.Fsck import qualified Command.Fsck
import qualified Annex import qualified Annex
import Logs.MetaData import Logs.MetaData
import Logs.Web
import qualified Remote
cmd :: Command cmd :: Command
cmd = notDirect $ withGlobalOptions annexedMatchingOptions $ cmd = notDirect $ withGlobalOptions annexedMatchingOptions $
@ -77,6 +79,12 @@ perform file oldkey oldbackend newbackend = go =<< genkey
finish newkey = ifM (Command.ReKey.linkKey file oldkey newkey) finish newkey = ifM (Command.ReKey.linkKey file oldkey newkey)
( do ( do
copyMetaData oldkey newkey copyMetaData oldkey newkey
-- If the old key had some associated urls, record them for
-- the new key as well.
urls <- getUrls oldkey
forM_ urls $ \url -> do
r <- Remote.claimingUrl url
setUrlPresent (Remote.uuid r) newkey url
next $ Command.ReKey.cleanup file oldkey newkey next $ Command.ReKey.cleanup file oldkey newkey
, error "failed" , error "failed"
) )

View file

@ -16,10 +16,8 @@ import Annex.Ingest
import Annex.Link import Annex.Link
import Annex.Perms import Annex.Perms
import Annex.ReplaceFile import Annex.ReplaceFile
import Logs.Web
import Logs.Location import Logs.Location
import Git.FilePath import Git.FilePath
import qualified Remote
import qualified Database.Keys import qualified Database.Keys
import Annex.InodeSentinal import Annex.InodeSentinal
import Utility.InodeCache import Utility.InodeCache
@ -93,13 +91,6 @@ linkKey file oldkey newkey = ifM (isJust <$> isAnnexLink file)
cleanup :: FilePath -> Key -> Key -> CommandCleanup cleanup :: FilePath -> Key -> Key -> CommandCleanup
cleanup file oldkey newkey = do cleanup file oldkey newkey = do
-- If the old key had some associated urls, record them for
-- the new key as well.
urls <- getUrls oldkey
forM_ urls $ \url -> do
r <- Remote.claimingUrl url
setUrlPresent (Remote.uuid r) newkey url
ifM (isJust <$> isAnnexLink file) ifM (isJust <$> isAnnexLink file)
( do ( do
-- Update symlink to use the new key. -- Update symlink to use the new key.

3
debian/changelog vendored
View file

@ -44,6 +44,9 @@ git-annex (6.20151219) UNRELEASED; urgency=medium
removed (but not git rmed). git still has the add staged in this case, removed (but not git rmed). git still has the add staged in this case,
so the content should not be unused and was wrongly treated as such. so the content should not be unused and was wrongly treated as such.
* migrate: Copy over metadata to new key. * migrate: Copy over metadata to new key.
* rekey: No longer copies over urls from the old to the new key.
It makes sense for migrate to do that, but not for this low-level
(and little used) plumbing command to.
-- Joey Hess <id@joeyh.name> Sat, 19 Dec 2015 13:31:17 -0400 -- Joey Hess <id@joeyh.name> Sat, 19 Dec 2015 13:31:17 -0400