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:
parent
00d4c7cd01
commit
cec25153ec
2 changed files with 7 additions and 2 deletions
|
@ -479,7 +479,7 @@ moveFromStart :: FilePath -> Annex (Maybe SubCmdPerform)
|
||||||
moveFromStart file = isAnnexed file $ \(key, _) -> do
|
moveFromStart file = isAnnexed file $ \(key, _) -> do
|
||||||
remote <- Remotes.commandLineRemote
|
remote <- Remotes.commandLineRemote
|
||||||
l <- Remotes.keyPossibilities key
|
l <- Remotes.keyPossibilities key
|
||||||
if (elem remote l)
|
if (not $ null $ filter (\r -> Remotes.same r remote) l)
|
||||||
then return $ Just $ moveFromPerform key
|
then return $ Just $ moveFromPerform key
|
||||||
else return Nothing
|
else return Nothing
|
||||||
moveFromPerform :: Key -> Annex (Maybe SubCmdCleanup)
|
moveFromPerform :: Key -> Annex (Maybe SubCmdCleanup)
|
||||||
|
|
|
@ -10,6 +10,7 @@ module Remotes (
|
||||||
keyPossibilities,
|
keyPossibilities,
|
||||||
tryGitConfigRead,
|
tryGitConfigRead,
|
||||||
inAnnex,
|
inAnnex,
|
||||||
|
same,
|
||||||
commandLineRemote,
|
commandLineRemote,
|
||||||
copyFromRemote,
|
copyFromRemote,
|
||||||
copyToRemote,
|
copyToRemote,
|
||||||
|
@ -47,7 +48,7 @@ keyPossibilities key = do
|
||||||
uuids <- liftIO $ keyLocations g key
|
uuids <- liftIO $ keyLocations g key
|
||||||
allremotes <- remotesByCost
|
allremotes <- remotesByCost
|
||||||
-- To determine if a remote has a key, its UUID needs to be known.
|
-- 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.
|
-- eg, a different drive is mounted at the same location.
|
||||||
-- But, reading the config of remotes can be expensive, so make
|
-- But, reading the config of remotes can be expensive, so make
|
||||||
-- sure we only do it once per git-annex run.
|
-- sure we only do it once per git-annex run.
|
||||||
|
@ -147,6 +148,10 @@ repoNotIgnored r = do
|
||||||
match name = name == Git.repoRemoteName r
|
match name = name == Git.repoRemoteName r
|
||||||
isIgnored ignored = Git.configTrue ignored
|
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. -}
|
{- Returns the remote specified by --from or --to, may fail with error. -}
|
||||||
commandLineRemote :: Annex Git.Repo
|
commandLineRemote :: Annex Git.Repo
|
||||||
commandLineRemote = do
|
commandLineRemote = do
|
||||||
|
|
Loading…
Add table
Reference in a new issue