diff --git a/CHANGELOG b/CHANGELOG index 4fa5822c91..4a8a96ed98 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -51,6 +51,8 @@ git-annex (7.20181025) UNRELEASED; urgency=medium was in the response, use it. * webapp: Fixed a crash when adding a git remote. (Reversion introduced in version 6.20180112) + * migrate: Fix failure to migrate from URL keys. + (Reversion introduced in version 6.20180926) -- Joey Hess Sat, 13 Oct 2018 00:52:02 -0400 diff --git a/Command/Migrate.hs b/Command/Migrate.hs index 245197e0dd..5ee16ab9b0 100644 --- a/Command/Migrate.hs +++ b/Command/Migrate.hs @@ -82,18 +82,18 @@ perform file oldkey oldbackend newbackend = go =<< genkey (fastMigrate oldbacken next $ Command.ReKey.cleanup file oldkey newkey , giveup "failed creating link from old to new key" ) - genkey Nothing = return Nothing + genkey Nothing = do + content <- calcRepo $ gitAnnexLocation oldkey + let source = KeySource + { keyFilename = file + , contentLocation = content + , inodeCache = Nothing + } + v <- genKey source (Just newbackend) + return $ case v of + Just (newkey, _) -> Just (newkey, False) + _ -> Nothing genkey (Just fm) = fm oldkey newbackend afile >>= \case - Just newkey -> return $ Just (newkey, True) - Nothing -> do - content <- calcRepo $ gitAnnexLocation oldkey - let source = KeySource - { keyFilename = file - , contentLocation = content - , inodeCache = Nothing - } - v <- genKey source (Just newbackend) - return $ case v of - Just (newkey, _) -> Just (newkey, False) - _ -> Nothing + Just newkey -> return (Just (newkey, True)) + Nothing -> genkey Nothing afile = AssociatedFile (Just file) diff --git a/doc/bugs/git-annex-migrate_fails.mdwn b/doc/bugs/git-annex-migrate_fails.mdwn index fd2e86d3e8..23c5d2d54b 100644 --- a/doc/bugs/git-annex-migrate_fails.mdwn +++ b/doc/bugs/git-annex-migrate_fails.mdwn @@ -24,3 +24,5 @@ Migrating from a URL key to an MD5E key (after addurl --fast using an external s [2018-10-29 15:17:15.621264] read: git ["--git-dir=.git","--work-tree=.","--literal-pathspecs","ls-files","--cached","-z","--","A4.taxfilt.bam"] migrate A4.taxfilt.bam failed git-annex: migrate: 1 failed + +> [[fixed|done]] --[[Joey]] diff --git a/doc/bugs/git-annex-migrate_fails/comment_1_4f8fb57ce001e0a2e1636bd7b3b79d43._comment b/doc/bugs/git-annex-migrate_fails/comment_1_4f8fb57ce001e0a2e1636bd7b3b79d43._comment new file mode 100644 index 0000000000..65dc057c50 --- /dev/null +++ b/doc/bugs/git-annex-migrate_fails/comment_1_4f8fb57ce001e0a2e1636bd7b3b79d43._comment @@ -0,0 +1,27 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2018-10-29T20:04:48Z" + content=""" +To reproduce this bug: + + joey@darkstar:/tmp/t>git annex addurl --fast --raw http://www.google.com/ --file A4.taxfilt.bam + addurl http://www.google.com/ (to A4.taxfilt.bam) ok + (recording state in git...) + joey@darkstar:/tmp/t>git annex get A4.taxfilt.bam + get A4.taxfilt.bam (from web...) + + ok + (recording state in git...) + joey@darkstar:/tmp/t>git annex migrate --backend=MD5E A4.taxfilt.bam + migrate A4.taxfilt.bam failed + git-annex: migrate: 1 failed + +Seems to be a bug in handling backends with fastMigrate = Nothing, causing +it to stop immediately without doing anything. Reversion introduced in +[[!commit 4ecba916a14e02dd62f8ba4257db810fa859f017]]. + +And calling `stop` in a CommandPerform causes this failure without an +explanation. I think that would be worth cleaning up at some point; +[[todo/do_not_allow_using_stop_in_CommandPerform]]. +"""]] diff --git a/doc/todo/do_not_allow_using_stop_in_CommandPerform.mdwn b/doc/todo/do_not_allow_using_stop_in_CommandPerform.mdwn new file mode 100644 index 0000000000..a6aeafdc83 --- /dev/null +++ b/doc/todo/do_not_allow_using_stop_in_CommandPerform.mdwn @@ -0,0 +1,19 @@ +`stop` does different things depending on the stage of a command that it's +used in. + +In CommandStart, it quietly stops any further action. + +In CommandPerform, it causes the command to fail, +which looks like "commandname actionitem failed". +If no other output is emitted to say why it failed, +this is not nice. + +(It can't be used in CommandCleanup.) + +It would be good to get rid of support for running `stop` in +CommandPerform. Simply change the type: + + - stop :: Annex (Maybe a) + + stop :: CommandStart + +And follow the compile errors.