bugfix: git annex move --from <file remote>

The data structure comparison didn't work because for a file remote,
the config gets read for one structure but not the other.
This commit is contained in:
Joey Hess 2010-10-31 23:38:07 -04:00
parent 00d4c7cd01
commit cec25153ec
2 changed files with 7 additions and 2 deletions

View file

@ -479,7 +479,7 @@ moveFromStart :: FilePath -> Annex (Maybe SubCmdPerform)
moveFromStart file = isAnnexed file $ \(key, _) -> do
remote <- Remotes.commandLineRemote
l <- Remotes.keyPossibilities key
if (elem remote l)
if (not $ null $ filter (\r -> Remotes.same r remote) l)
then return $ Just $ moveFromPerform key
else return Nothing
moveFromPerform :: Key -> Annex (Maybe SubCmdCleanup)

View file

@ -10,6 +10,7 @@ module Remotes (
keyPossibilities,
tryGitConfigRead,
inAnnex,
same,
commandLineRemote,
copyFromRemote,
copyToRemote,
@ -47,7 +48,7 @@ keyPossibilities key = do
uuids <- liftIO $ keyLocations g key
allremotes <- remotesByCost
-- To determine if a remote has a key, its UUID needs to be known.
-- The locally cached UIIDs of remotes can fall out of date if
-- The locally cached UUIDs of remotes can fall out of date if
-- eg, a different drive is mounted at the same location.
-- But, reading the config of remotes can be expensive, so make
-- sure we only do it once per git-annex run.
@ -147,6 +148,10 @@ repoNotIgnored r = do
match name = name == Git.repoRemoteName r
isIgnored ignored = Git.configTrue ignored
{- Checks if two repos are the same, by comparing their remote names. -}
same :: Git.Repo -> Git.Repo -> Bool
same a b = Git.repoRemoteName a == Git.repoRemoteName b
{- Returns the remote specified by --from or --to, may fail with error. -}
commandLineRemote :: Annex Git.Repo
commandLineRemote = do