summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-31 23:38:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-31 23:38:07 -0400
commitcec25153ecd4f824cf150afbd294ad0c5ed1413e (patch)
treee9326121cd6be570c48fb7d09b047e52599ba1c3
parent00d4c7cd01b6f6e863a22483b9ea20ca5260da43 (diff)
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.
-rw-r--r--Commands.hs2
-rw-r--r--Remotes.hs7
2 files changed, 7 insertions, 2 deletions
diff --git a/Commands.hs b/Commands.hs
index fb76e5502..507c82ccc 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 2879516fe..dffbe8f50 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