summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-09-15 15:33:20 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-09-15 15:33:20 -0400
commite47d1fd43e2433966b7baa6fc179ec6b70774214 (patch)
tree8a0778a3b989c010fac05ab3886144f65346393c
parenta0d3a343b52fba63df523d49849b43217ce744ab (diff)
add error for move --auto
It probably does not make sense to enable auto mode for move. I cannot think of a situation where it would make sense to try to use it. A hypothetical auto mode for move would only differ from a normal move in one case -- when both repositories have a file, move deletes it from one, and this reduces the number of copies. So an auto mode would either only let move work in that situation, or avoid removing the file in that situation, depending on the number of copies. This would be complex to implement, and is perhaps not a very obvious behavior. The error is a good thing to have, so users don't expect it to do something it does not.
-rw-r--r--Command/Move.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Command/Move.hs b/Command/Move.hs
index 88da92f0a..f4310a2b8 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -18,6 +18,7 @@ import Content
import qualified Remote
import UUID
import Messages
+import Utility.Conditional
command :: [Command]
command = [repoCommand "move" paramPaths seek
@@ -32,6 +33,7 @@ seek = [withFilesInGit $ start True]
- moving data in the key-value backend. -}
start :: Bool -> CommandStartString
start move file = do
+ noAuto
to <- Annex.getState Annex.toremote
from <- Annex.getState Annex.fromremote
case (from, to) of
@@ -43,6 +45,9 @@ start move file = do
src <- Remote.byName name
fromStart src move file
(_ , _) -> error "only one of --from or --to can be specified"
+ where
+ noAuto = when move $ whenM (Annex.getState Annex.auto) $ error
+ "--auto is not supported for move"
showMoveAction :: Bool -> FilePath -> Annex ()
showMoveAction True file = showStart "move" file