From 7b2da21ab7bc51785203a69cc05ab811a8629ecb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 26 Jan 2011 15:59:10 -0400 Subject: avoid moving if src and dest are the same --- Command/Move.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Command/Move.hs b/Command/Move.hs index 4416134c0..d52ca07df 100644 --- a/Command/Move.hs +++ b/Command/Move.hs @@ -71,8 +71,9 @@ remoteHasKey remote key present = do -} toStart :: Git.Repo -> Bool -> CommandStartString toStart dest move file = isAnnexed file $ \(key, _) -> do + g <- Annex.gitRepo ishere <- inAnnex key - if not ishere + if not ishere || g == dest then return Nothing -- not here, so nothing to do else do showAction move file @@ -108,8 +109,9 @@ toCleanup dest move key = do -} fromStart :: Git.Repo -> Bool -> CommandStartString fromStart src move file = isAnnexed file $ \(key, _) -> do + g <- Annex.gitRepo (trusted, untrusted, _) <- Remotes.keyPossibilities key - if null $ filter (\r -> Remotes.same r src) (trusted ++ untrusted) + if (g == src) || (null $ filter (\r -> Remotes.same r src) (trusted ++ untrusted)) then return Nothing else do showAction move file -- cgit v1.2.3