fsck --all --from was checking the content of files in the local repository, rather than on the special remote.
Straight up forgot to handle this case! This commit was sponsored by Fernando Jimenez on Patreon.
This commit is contained in:
parent
b4b970d5f2
commit
2577f1c0a2
3 changed files with 16 additions and 10 deletions
|
@ -11,6 +11,8 @@ git-annex (6.20161112) UNRELEASED; urgency=medium
|
|||
direct mode repository work the same as it works in indirect mode.
|
||||
* Avoid backtraces on expected failures when built with ghc 8;
|
||||
only use backtraces for unexpected errors.
|
||||
* fsck --all --from was checking the existence and content of files
|
||||
in the local repository, rather than on the special remote. Oops.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Tue, 15 Nov 2016 11:15:27 -0400
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ seek o = allowConcurrentOutput $ do
|
|||
checkDeadRepo u
|
||||
i <- prepIncremental u (incrementalOpt o)
|
||||
withKeyOptions (keyOptions o) False
|
||||
(\k ai -> startKey i k ai =<< getNumCopies)
|
||||
(\k ai -> startKey from i k ai =<< getNumCopies)
|
||||
(withFilesInGit $ whenAnnexed $ start from i)
|
||||
(fsckFiles o)
|
||||
cleanupIncremental i
|
||||
|
@ -109,7 +109,7 @@ start from inc file key = do
|
|||
numcopies <- getFileNumCopies file
|
||||
case from of
|
||||
Nothing -> go $ perform key file backend numcopies
|
||||
Just r -> go $ performRemote key file backend numcopies r
|
||||
Just r -> go $ performRemote key (Just file) backend numcopies r
|
||||
where
|
||||
go = runFsck inc (mkActionItem (Just file)) key
|
||||
|
||||
|
@ -129,8 +129,8 @@ perform key file backend numcopies = do
|
|||
|
||||
{- To fsck a remote, the content is retrieved to a tmp file,
|
||||
- and checked locally. -}
|
||||
performRemote :: Key -> FilePath -> Backend -> NumCopies -> Remote -> Annex Bool
|
||||
performRemote key file backend numcopies remote =
|
||||
performRemote :: Key -> AssociatedFile -> Backend -> NumCopies -> Remote -> Annex Bool
|
||||
performRemote key afile backend numcopies remote =
|
||||
dispatch =<< Remote.hasKey remote key
|
||||
where
|
||||
dispatch (Left err) = do
|
||||
|
@ -147,10 +147,10 @@ performRemote key file backend numcopies remote =
|
|||
return False
|
||||
dispatch (Right False) = go False Nothing
|
||||
go present localcopy = check
|
||||
[ verifyLocationLogRemote key file remote present
|
||||
[ verifyLocationLogRemote key (maybe (key2file key) id afile) remote present
|
||||
, checkKeySizeRemote key remote localcopy
|
||||
, checkBackendRemote backend key remote localcopy
|
||||
, checkKeyNumCopies key (Just file) numcopies
|
||||
, checkKeyNumCopies key afile numcopies
|
||||
]
|
||||
withtmp a = do
|
||||
pid <- liftIO getPID
|
||||
|
@ -161,7 +161,7 @@ performRemote key file backend numcopies remote =
|
|||
cleanup
|
||||
cleanup `after` a tmp
|
||||
getfile tmp = ifM (checkDiskSpace (Just (takeDirectory tmp)) key 0 True)
|
||||
( ifM (Remote.retrieveKeyFileCheap remote key (Just file) tmp)
|
||||
( ifM (Remote.retrieveKeyFileCheap remote key afile tmp)
|
||||
( return (Just True)
|
||||
, ifM (Annex.getState Annex.fast)
|
||||
( return Nothing
|
||||
|
@ -173,12 +173,14 @@ performRemote key file backend numcopies remote =
|
|||
)
|
||||
dummymeter _ = noop
|
||||
|
||||
startKey :: Incremental -> Key -> ActionItem -> NumCopies -> CommandStart
|
||||
startKey inc key ai numcopies =
|
||||
startKey :: Maybe Remote -> Incremental -> Key -> ActionItem -> NumCopies -> CommandStart
|
||||
startKey from inc key ai numcopies =
|
||||
case Backend.maybeLookupBackendName (keyBackendName key) of
|
||||
Nothing -> stop
|
||||
Just backend -> runFsck inc ai key $
|
||||
performKey key backend numcopies
|
||||
case from of
|
||||
Nothing -> performKey key backend numcopies
|
||||
Just r -> performRemote key Nothing backend numcopies r
|
||||
|
||||
performKey :: Key -> Backend -> NumCopies -> Annex Bool
|
||||
performKey key backend numcopies = do
|
||||
|
|
|
@ -24,3 +24,5 @@ I tried to use `git-annex-fsck --all --from remote` to check files on a special
|
|||
### Have you had any luck using git-annex before?
|
||||
Yes, it's been very helpful for managing large files between laptops, desktops, external storage, and remote storage.
|
||||
|
||||
> Thanks for an excellent test case and a clear bug report. I've fixed this
|
||||
> bug. [[done]] --[[Joey]]
|
||||
|
|
Loading…
Reference in a new issue