Added annex.freezecontent-command and annex.thawcontent-command configs

Freeze first sets the file perms, and then runs
freezecontent-command. Thaw runs thawcontent-command before
restoring file permissions. This is in case the freeze command
prevents changing file perms, as eg setting a file immutable does.
Also, changing file perms tends to mess up previously set ACLs.

git-annex init's probe for crippled filesystem uses them, so if file perms
don't work, but freezecontent-command manages to prevent write to a file,
it won't treat the filesystem as crippled.

When the the filesystem has been probed as crippled, the hooks are not
used, because there seems to be no point then; git-annex won't be relying
on locking annex objects down. Also, this avoids them being run when the
file perms have not been changed, in case they somehow rely on
git-annex's setting of the file perms in order to work.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2021-06-21 14:40:20 -04:00
parent ba62c3467b
commit 4b1b9d7a83
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
8 changed files with 88 additions and 31 deletions

View file

@ -15,7 +15,7 @@ Use cases include:
Design:
Configs: annex.lockdown-command, annex.unlockdown-command
Configs: annex.freezecontent-command, annex.thawcontent-command
In these, "%path" is replaced with the file/directory to act on.
Locking down a directory only needs to do the equivilant of removing its
@ -49,5 +49,11 @@ fed the names of files to operate on via stdin.
> hook could also support things like [[storing_xattrs|support_for_storing_xattrs]]
> --[[Joey]]
[[!tag needsthought]]
[[!tag projects/datalad]]
> [[done]].. `git-annex init` does run annex.freezecontent-command and if it
> prevents writing to a file, it will avoid setting
> annex.crippledfilesystem.
>
> I didn't make `git-annex test` use the global git config of the hooks
> though, not sure if that really makes sense or is needed.