hook - Gitolite 更新 Hook 排除存储库

标签 hook gitolite

我正在添加一个 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 called FOO is triggered. Note that the program isn't even called if the VREF 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/

相关文章:

c# - 如何添加系统 "windows hook"以便在创建/激活窗口时收到通知?

c++ - 当任何进程(包括恶意软件)都可以使用 VirtualProtect 时,它有什么意义?

git/gitolite : moving repos after setting up gitolite

git 忽略文件模式配置不起作用

GIT Smart Http - R 任何被 fallthru 拒绝

r - knitr:带有output.lines=选项的输出钩子(Hook),其工作方式类似于echo=2:6

c++ - 使用 Hook Engine 时的 ACCESS_VIOLATION

java - 添加 checkstyle 作为预提交 git 钩子(Hook)

git - 安装 gitolite 时我得到 "/tmp/id_rsa.pub does not seem to be a valid ssh pubkey file"

git - 如何授予用户访问 gitolite 中所有存储库的权限?