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:
Joey Hess 2025-01-10 14:50:49 -04:00
parent 5df1b2b36e
commit a73fa77417
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
11 changed files with 131 additions and 53 deletions

View file

@ -1154,17 +1154,20 @@ repository, using [[git-annex-config]]. See its man page for a list.)
This command is run and its output is used as the commit message to the
git-annex branch.
Alternatively, a hook script can be installed in
`.git/hooks/commitmessage-annex`
* `annex.post-update-command`
This command is run after git-annex updates the git-annex branch.
Alternatively, a hook script can be installed in
`.git/hooks/post-update-annex`
When publishing a git-annex repository by http, this can be used to run
`git update-server-info`
Alternatively, a hook script can be installed in
`.git/hooks/post-update-annex`
* `annex.pre-commit-command`
This command is run whenever a commit is made to the HEAD branch of
@ -1422,21 +1425,28 @@ repository, using [[git-annex-config]]. See its man page for a list.)
erased.
For example, to use the wipe command, set it to `wipe -f %file`.
Alternatively to setting the git config, a hook script can be installed
in `.git/hooks/secure-erase-annex`
* `annex.freezecontent-command`, `annex.thawcontent-command`
Usually the write permission bits are unset to protect annexed objects
from being modified or deleted. The freezecontent-command is run after
from being modified or deleted. Freezecontent is run after
git-annex has removed (or attempted to remove) the write bit, and can
be used to prevent writing in some other way.
The thawcontent-command should undo its effect, and is run before
Tawcontent should undo its effect, and is run before
git-annex restores the write bit.
In the command line, %path is replaced with the file or directory to
operate on.
(When annex.crippledfilesystem is set, git-annex will not try to
remove/restore the write bit, but it will still run these hooks.)
remove/restore the write bit, but it will still run freezecontent and
thawcontent.)
Alternatively to setting the git config, hook scripts can be installed
in `.git/hooks/freezecontent-annex` and `.git/hooks/thawcontent-annex`.
* `annex.tune.objecthash1`, `annex.tune.objecthashlower`, `annex.tune.branchhash1`
@ -2065,6 +2075,9 @@ Remotes are configured using these settings in `.git/config`.
If set, the command is run and each line of its output is used as a HTTP
header. This overrides annex.http-headers.
Alternatively, a hook script can be installed in
`.git/hooks/http-headers-annex`
* `annex.security.allowed-url-schemes`

View file

@ -25,3 +25,5 @@ I wonder if there could be a way added to be able to specify them relative to th
[[!meta author=yoh]]
[[!tag projects/repronim]]
> [[done]] --[[Joey]]

View file

@ -23,12 +23,11 @@ hook that git-annex writes. But, it seems worth having the git config just
for consistency.
There are some things like annex.youtube-dl-command and
annex.http-headers-command that are configuring commands for git-annex to
annex.shared-sop-command that are configuring commands for git-annex to
run, and are not really hooks per se.
And it does not make sense to have hook scripts that a specific to a given
remote corresponding to configs like `remote.name.annex-cost-command`.
Instead it might make sense to have a `.git/hooks/remote-cost-annex` that
is passed the name of the remote, but that bridge can be crossed if we
come to it.
Instead there could be a single `.git/hooks/remote-cost-annex` that
is passed the name of the remote.
"""]]

View file

@ -0,0 +1,12 @@
[[!comment format=mdwn
username="joey"
subject="""comment 7"""
date="2025-01-10T18:50:07Z"
content="""
Implemented hooks: freezecontent-annex, thawcontent-annex,
secure-erase-annex, commitmessage-annex, http-headers-annex
That leaves only `remote.name.annex-cost-command` and similar git configs
that don't have hooks. And a few like annex.youtube-dl-command that are not
really equivilant to hooks.
"""]]