summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-08 23:56:37 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-08 23:56:37 -0400
commit67b8e8d55eefde1978fa92ae49020d161a9f544b (patch)
treedf7a4f44afdd896bec663be71ca50882cd06a8bf /Annex
parentc79f8456dd2a74b028c66d3953062140d428b0ed (diff)
implement massReplace
This looks at the string one char at a time, which is hardly efficient.. but more than good enough for expanding variables in relatively short command lines.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Content.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 5985bf227..0f9c4acdf 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -447,12 +447,12 @@ downloadUrl urls file = go =<< annexWebDownloadCommand <$> Annex.getGitConfig
liftIO $ anyM (\u -> Url.download u headers opts file) urls
go (Just basecmd) = liftIO $ anyM (downloadcmd basecmd) urls
downloadcmd basecmd url =
- boolSystem "sh" [Param "-c", Param $ gencmd basecmd url]
+ boolSystem "sh" [Param "-c", Param $ gencmd url basecmd]
<&&> doesFileExist file
- gencmd basecmd url =
- replace "%file" (shellEscape file) $
- replace "%url" (shellEscape url)
- basecmd
+ gencmd url = massReplace
+ [ ("%file", shellEscape file)
+ , ("%url", shellEscape url)
+ ]
{- Copies a key's content, when present, to a temp file.
- This is used to speed up some rsyncs. -}