migrate: Fix failure to migrate from URL keys. (Reversion introduced in version 6.20180926)

This commit is contained in:
Joey Hess 2018-10-29 16:26:43 -04:00
parent d73f92d8bc
commit 4431b82bce
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 63 additions and 13 deletions

View file

@ -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 <id@joeyh.name> Sat, 13 Oct 2018 00:52:02 -0400

View file

@ -82,10 +82,7 @@ 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 (Just fm) = fm oldkey newbackend afile >>= \case
Just newkey -> return $ Just (newkey, True)
Nothing -> do
genkey Nothing = do
content <- calcRepo $ gitAnnexLocation oldkey
let source = KeySource
{ keyFilename = file
@ -96,4 +93,7 @@ perform file oldkey oldbackend newbackend = go =<< genkey (fastMigrate oldbacken
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 -> genkey Nothing
afile = AssociatedFile (Just file)

View file

@ -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]]

View file

@ -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]].
"""]]

View file

@ -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.