From 220317df5a115eb815a0112073f35d7e107c65d7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 16 Oct 2018 16:45:08 -0400 Subject: [PATCH] v6: fix migrate of unlocked file After commit b2bafdb2fcfe83a864bfc11e2684f5c697613dfd the test suite threw up a failure migrating unlocked files. I'm not clear how that commit broke it (presumably by inAnnex reporting the right information now), but the actual problem is plain: The inodecache for the worktree file is generated, but then the file is replaced with a copy (unncessarily unless annex.link is set, but the code always does so) and so linkToAnnex/linkAnnex then fails because it notices the inode cache is not valid. This commit was sponsored by Jake Vosloo on Patreon. --- Command/ReKey.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Command/ReKey.hs b/Command/ReKey.hs index 9b7e5f65e8..cd67ed2fd0 100644 --- a/Command/ReKey.hs +++ b/Command/ReKey.hs @@ -87,7 +87,6 @@ linkKey file oldkey newkey = ifM (isJust <$> isAnnexLink file) oldobj <- calcRepo (gitAnnexLocation oldkey) isJust <$> linkOrCopy' (return True) newkey oldobj tmp Nothing , do - ic <- withTSDelta (liftIO . genInodeCache file) {- The file being rekeyed is itself an unlocked file, so if - it's linked to the old key, that link must be broken. -} oldobj <- calcRepo (gitAnnexLocation oldkey) @@ -99,6 +98,7 @@ linkKey file oldkey newkey = ifM (isJust <$> isAnnexLink file) oldic <- withTSDelta (liftIO . genInodeCache oldobj) whenM (isUnmodified oldkey oldobj) $ Database.Keys.addInodeCaches oldkey (catMaybes [oldic]) + ic <- withTSDelta (liftIO . genInodeCache file) case v of Left e -> do warning (show e)