diff options
author | Joey Hess <joey@kitenet.net> | 2011-06-09 18:54:49 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-06-09 18:54:49 -0400 |
commit | 90dd245522ccffee0e77eba3b79e32d6029977fc (patch) | |
tree | 88f243d03da2a8906b6ac30bbb688f67d5646d3e /Command/Get.hs | |
parent | 2136534be156c78273f949c34a9f54cdb37b7560 (diff) |
get --from is the same as copy --from
get not honoring --from has surprised me a few times, so least surprise
suggests it should just behave like copy --from. This leaves the difference
between get and copy being that copy always requires the remote to copy
from, while get will decide whether to get a file from a key/value store or
a remote.
Diffstat (limited to 'Command/Get.hs')
-rw-r--r-- | Command/Get.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Command/Get.hs b/Command/Get.hs index 90c054096..50dc009fe 100644 --- a/Command/Get.hs +++ b/Command/Get.hs @@ -9,9 +9,12 @@ module Command.Get where import Command import qualified Backend +import qualified Annex +import qualified Remote import Types import Content import Messages +import qualified Command.Move command :: [Command] command = [repoCommand "get" paramPath seek @@ -20,7 +23,6 @@ command = [repoCommand "get" paramPath seek seek :: [CommandSeek] seek = [withFilesInGit start] -{- Gets an annexed file from one of the backends. -} start :: CommandStartString start file = isAnnexed file $ \(key, backend) -> do inannex <- inAnnex key @@ -28,7 +30,12 @@ start file = isAnnexed file $ \(key, backend) -> do then stop else do showStart "get" file - next $ perform key backend + from <- Annex.getState Annex.fromremote + case from of + Nothing -> next $ perform key backend + Just name -> do + src <- Remote.byName name + next $ Command.Move.fromPerform src False key perform :: Key -> Backend Annex -> CommandPerform perform key backend = do |