added hooks corresponding to annex.*-command
* Added freezecontent-annex and thawcontent-annex hooks that correspond to the git configs annex.freezecontent and annex.thawcontent. * Added secure-erase-annex hook that corresponds to the git config annex.secure-erase-command. * Added commitmessage-annex hook that corresponds to the git config annex.commitmessage-command. * Added http-headers-annex hook that corresponds to the git config annex.http-headers-command. that correspond to the post-update-annex and pre-commit-annex hooks. The use case for these is eg, setting up a git repository that is run in a container, where the easiest way to provide a script is by putting it in .git/hooks/, rather than copying it into the container in a way that puts it in PATH. This is all the ones that make sense to add for annex.*-config git configs. annex.youtube-dl-command is not a hook, it's telling git-annex what command to run. So is annex.shared-sop-command. So omitted those. May later also want to add hooks corresponding to `remote.<name>.annex-cost-command` etc. Sponsored-by: the NIH-funded NICEMAN (ReproNim TR&D3) project
This commit is contained in:
parent
5df1b2b36e
commit
a73fa77417
11 changed files with 131 additions and 53 deletions
|
@ -35,6 +35,7 @@ import Annex.Common
|
|||
import qualified Annex
|
||||
import qualified Utility.Url as U
|
||||
import qualified Utility.Url.Parse as U
|
||||
import Annex.Hook
|
||||
import Utility.Hash (IncrementalVerifier)
|
||||
import Utility.IPAddress
|
||||
import Network.HTTP.Client.Restricted
|
||||
|
@ -75,9 +76,11 @@ getUrlOptions = Annex.getState Annex.urloptions >>= \case
|
|||
<*> pure (Just (\u -> "Configuration of annex.security.allowed-url-schemes does not allow accessing " ++ show u))
|
||||
<*> pure U.noBasicAuth
|
||||
|
||||
headers = annexHttpHeadersCommand <$> Annex.getGitConfig >>= \case
|
||||
Just cmd -> lines <$> liftIO (readProcess "sh" ["-c", cmd])
|
||||
Nothing -> annexHttpHeaders <$> Annex.getGitConfig
|
||||
headers =
|
||||
outputOfAnnexHook httpHeadersAnnexHook annexHttpHeadersCommand
|
||||
>>= \case
|
||||
Just output -> pure (lines output)
|
||||
Nothing -> annexHttpHeaders <$> Annex.getGitConfig
|
||||
|
||||
checkallowedaddr = words . annexAllowedIPAddresses <$> Annex.getGitConfig >>= \case
|
||||
["all"] -> do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue