我正在添加一个 gitolite 更新 Hook 作为 VREF,并且想知道是否有办法将它应用于除 gitolite-admin 之外的所有存储库。
有一个更简单的方法而不是列出我想要应用 Hook 的所有存储库会很棒。
目前我有:
repo @all
- VREF/update = @all
我正在考虑为 gitolite-admin 存储库添加一个异常(exception)。 像这样的东西:
repo gitolite-admin
RW+ VREF/update = @all
repo @all
- VREF/update = @all
有没有办法让这样的规则生效?谢谢您的帮助! (这个方法我试过了,好像不行)
最佳答案
仅供其他不太熟悉 VREF
的读者使用(由 "g3" or Gitolite V3 介绍)。
背后的想法VREF rules是:
- For every refex starting with
VREF/FOO/
in a rule that applies to this user, a call to a program calledFOO
is triggered. Note that the program isn't even called if theVREF
rule doesn't apply to that user.
这就是为什么即使 update
hook is reserved by gitolite 也可以定义一个 'update
' 钩子(Hook)的原因.
普通的 update
Hook 需要 3 个参数(ref、旧 SHA、新 SHA)。
任何 VREF 都会得到这三个,然后至少还有 4 个。您的“更新
”VREF 应该忽略额外的参数。
- fallthru is considering success (ie you won't be denied a git operation on a repo because none of the VREF applied)
If fallthru were to be considered 'failure', you'd be forced to add a "success rule" like this for every vref you used in this repo, in each case listing every user who was not already mentioned in the context of that vref
考虑到 update
VREF 程序,您可以添加一个参数,让您的更新脚本识别它是在 gitolite-admin
上下文中调用的(并且应该什么也不做):
repo gitolite-admin
- VREF/update/donothing = @all
repo @all
- VREF/update = @all
关于hook - Gitolite 更新 Hook 排除存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11510046/