pre-init config and hook

Added annex.pre-init-command git config and pre-init-annex hook that is run
before git-annex repository initialization.

This can block initialization. Or it can preform pre-initialization
configuration or tweaking.

I left stdio connected while it's running, so it could also be used for
interactive prompting conceivably, although that would want to use /dev/tty
anyway probably in order to not pollute the stdout of a command when
automatic initialization is done.

Sponsored-by: Dartmouth College's OpenNeuro project
This commit is contained in:
Joey Hess 2025-01-13 14:22:49 -04:00
parent 9e95556d69
commit 42d55bc57c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 87 additions and 19 deletions

View file

@ -97,6 +97,7 @@ data GitConfig = GitConfig
, annexAlwaysCompact :: Bool
, annexCommitMessage :: Maybe String
, annexCommitMessageCommand :: Maybe String
, annexPreInitCommand :: Maybe String
, annexPreCommitCommand :: Maybe String
, annexPostUpdateCommand :: Maybe String
, annexMergeAnnexBranches :: Bool
@ -192,6 +193,7 @@ extractGitConfig configsource r = GitConfig
, annexAlwaysCompact = getbool (annexConfig "alwayscompact") True
, annexCommitMessage = getmaybe (annexConfig "commitmessage")
, annexCommitMessageCommand = getmaybe (annexConfig "commitmessage-command")
, annexPreInitCommand = getmaybe (annexConfig "pre-init-command")
, annexPreCommitCommand = getmaybe (annexConfig "pre-commit-command")
, annexPostUpdateCommand = getmaybe (annexConfig "post-update-command")
, annexMergeAnnexBranches = getbool (annexConfig "merge-annex-branches") True