diff --git a/Commands.hs b/Commands.hs index fb76e5502f..507c82cccc 100644 --- a/Commands.hs +++ b/Commands.hs @@ -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) diff --git a/Remotes.hs b/Remotes.hs index 2879516fe1..dffbe8f502 100644 --- a/Remotes.hs +++ b/Remotes.hs @@ -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