summaryrefslogtreecommitdiff
path: root/Command/Get.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-01-06 04:02:35 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-01-06 04:06:13 -0400
commitdf21cbfdd2b7342c206ebd4aea32d989328374dc (patch)
tree24f6624e4e4c6dc06b53735bfb52973366e7b159 /Command/Get.hs
parent0a36f92a31196451c2d838fd0ae15527e8bbce18 (diff)
look up --to and --from remote names only once
This will speed up commands like move and drop.
Diffstat (limited to 'Command/Get.hs')
-rw-r--r--Command/Get.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/Command/Get.hs b/Command/Get.hs
index 4a50fe3fe..1a0435c36 100644
--- a/Command/Get.hs
+++ b/Command/Get.hs
@@ -18,17 +18,16 @@ def = [withOptions [Command.Move.fromOption] $ command "get" paramPaths seek
"make content of annexed files available"]
seek :: [CommandSeek]
-seek = [withField "from" id $ \from -> withNumCopies $ \n ->
+seek = [withField "from" Remote.byName $ \from -> withNumCopies $ \n ->
whenAnnexed $ start from n]
-start :: Maybe String -> Maybe Int -> FilePath -> (Key, Backend) -> CommandStart
+start :: Maybe Remote -> Maybe Int -> FilePath -> (Key, Backend) -> CommandStart
start from numcopies file (key, _) = stopUnless (not <$> inAnnex key) $
autoCopies key (<) numcopies $ do
case from of
Nothing -> go $ perform key
- Just name -> do
+ Just src -> do
-- get --from = copy --from
- src <- Remote.byName name
stopUnless (Command.Move.fromOk src key) $
go $ Command.Move.fromPerform src False key
where