summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-01-26 15:59:10 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-01-26 15:59:10 -0400
commit7b2da21ab7bc51785203a69cc05ab811a8629ecb (patch)
tree43d80cd9c07d142bae74c87696f6a29707e5914a
parent268cb35e644754093db003aee08d050a1f3f9466 (diff)
avoid moving if src and dest are the same
-rw-r--r--Command/Move.hs6
1 files 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