feat: configure the name of the checksums dir using env. var or git config
I was trying to set centralized server hooks for a gitea instance and I had a problem with having centralized trust configuration because if I create a symbolic link to .githooks.checksums in the gitea init.templateDir it isn't copied in new repos, because it's a hidden directory. So I figured a way to set the name of the checksums' directory would fix my issue.
I don't know if it is Gitea specific, or this might be the case for all git service providers(e.g. gitlab, bitbucket). If it isn't specific to Gitea it will be very useful for others as well.
@victorciresica : Thats actually correct, it does not work.
- Probably the solution is better as you suggest.
Thanks for providing a PR -> Actually, its nice somebody uses this on Gitea, I once did that long ago too on a company instance.
I will have look at the PR =)
@victorciresica I enabled CI for forked PRs, it might enable when you ammend the commit.
I need to figure out next week why the CI is not running probably due to pipeline.yml which has some wrong settings.
@victorciresica : You can run the tests with just test and just test-user. The tests are fully dockerized...
If you use Nix, there is a Nix shell with .envrc.
@gabyx I did the changes you suggested. It remains just to add update the readme as well.
@victorciresica : The question I have is; When you set a global checksums directory -> this directory could grow and nobody cleans that on Gitea, but you are right there are only a few deliberate hooks the server maintainer sets up so the directory containing the checksums will only be small and of limited size...
Also you read that section right: trust all hooks on the Server: https://github.com/gabyx/Githooks?tab=readme-ov-file#install-on-the-server especially:
# Automatically accept changes to all existing and new
# hooks in the current repository.
# This makes the fatal trust prompt pass.
git hooks config trust-all-hooks --accept
I would just leave the checksum directory local and not set it (rendering this PR actually obsolete ... I will still consider to merge it, since it actually is ok!)
Because on the server (Gitea) you will most likely set a few global hooks either with global shared hooks (or inside the init.templateDir if you use that...
https://github.com/gabyx/Githooks/blob/main/docs/cli/git_hooks_shared_add.md
git hooks shared add --global file:///path/to/the/shared/hooks/repo
I did read the section on trust-all-hooks, but it can only be set locally, on one repo at a time. I would like something global. So, I think the feature is still useful. @gabyx what do you think?