diff --git a/Command/AddComputed.hs b/Command/AddComputed.hs index 8af8e7c900..8b983a738c 100644 --- a/Command/AddComputed.hs +++ b/Command/AddComputed.hs @@ -88,8 +88,8 @@ perform o r program = do repopath <- fromRepo Git.repoPath subdir <- liftIO $ relPathDirToFile repopath (literalOsPath ".") let state = Remote.Compute.ComputeState - -- TODO add inherited initremote parameters - { Remote.Compute.computeParams = computeParams o + { Remote.Compute.computeParams = computeParams o ++ + Remote.Compute.defaultComputeParams r , Remote.Compute.computeInputs = mempty , Remote.Compute.computeOutputs = mempty , Remote.Compute.computeSubdir = subdir diff --git a/Remote/Compute.hs b/Remote/Compute.hs index b6ba1dbf2e..09ab45687a 100644 --- a/Remote/Compute.hs +++ b/Remote/Compute.hs @@ -17,6 +17,7 @@ module Remote.Compute ( getComputeProgram, runComputeProgram, ImmutableState(..), + defaultComputeParams, ) where import Annex.Common @@ -127,6 +128,11 @@ computeConfigParser _ = return $ RemoteConfigParser ) } +defaultComputeParams :: Remote -> [String] +defaultComputeParams = map mk . M.toList . getRemoteConfigPassedThrough . config + where + mk (f, v) = fromProposedAccepted f ++ '=' : v + newtype ComputeProgram = ComputeProgram String deriving (Show) diff --git a/doc/git-annex-addcomputed.mdwn b/doc/git-annex-addcomputed.mdwn index 1da287f0cf..245d4a04b0 100644 --- a/doc/git-annex-addcomputed.mdwn +++ b/doc/git-annex-addcomputed.mdwn @@ -33,7 +33,9 @@ Some examples of how this might look: git-annex addcomputed --to=y -- compress foo --level=9 git-annex addcomputed --to=z -- clip foo 2:01-3:00 combine with bar to baz - +Note that parameters that were passed to `git-annex initremote` +when setting up the compute special remote will be appended to the end of +the parameters provided to `git-annex addcomputed`. # OPTIONS @@ -88,6 +90,8 @@ Some examples of how this might look: [[git-annex-recompute]](1) +[[git-annex-initremote]](1) + # AUTHOR Joey Hess diff --git a/doc/special_remotes/compute.mdwn b/doc/special_remotes/compute.mdwn index b840f5fcbe..c3f4186008 100644 --- a/doc/special_remotes/compute.mdwn +++ b/doc/special_remotes/compute.mdwn @@ -2,6 +2,10 @@ While other remotes store the contents of annexed files somewhere, this special remote uses a program to compute the contents of annexed files. +To add a file to a compute special remote, use the [[git-annex-addcomputed]] +command. Once a file has been added to a compute special remote, commands +like `git-annex get` will use it to compute the content of the file. + To enable an instance of this special remote: # git-annex initremote myremote type=compute program=git-annex-compute-foo @@ -11,16 +15,11 @@ program to use to compute the contents of annexed files. It must start with "git-annex-compute-". The program needs to be installed somewhere in the `PATH`. -To add a file to a compute special remote, use the [[git-annex-addcomputed]] -command. Once a file has been added to a compute special remote, commands -like `git-annex get` will use it to compute the content of the file. +All other "field=value" parameters passed to `initremote` will be passed +to the program when running [[git-annex-addcomputed]]. Note that when the +program takes a dashed option, it can be provided after "--": -You can provide other parameters to `initremote`, in order to provide -default configuration values to use when adding files with -[[git-annex-addcomputed]]. To see a list of all the configuration values -supported by a given program, pass `--whatelse` to `initremote`: - - # git-annex initremote myremote type=compute program=git-annex-compute-foo --whatelse + # git-annex initremote myremote type=compute program=git-annex-compute-foo -- --level=9 ## compute programs