Gitolite Update Hook exclude a repository

試著忘記壹切 提交于 2019-12-28 06:50:30

问题


I'm adding a gitolite update hook as a VREF and was wondering if there was a way to apply it to all of the repositories except for the gitolite-admin one.

Having a simpler way rather than listing all of the repositories I want to apply the hook on would be great.

Currently I have:

repo @all
-    VREF/update    =   @all

I was thinking of adding an exception above that one for the gitolite-admin repository. Something like:

repo gitolite-admin
RW+  VREF/update    =   @all

repo @all
-    VREF/update    =   @all

Is there a way to get a rule like this to work? Thanks for the help! (I tried this way and it didn't seem to work)


回答1:


Just for other readers less familiar with VREF (introduced with "g3" or Gitolite V3).

The idea behind VREF rules are:

  • 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.

This is why one can define an 'update' hook even though the update hook is reserved by gitolite.
A normal update hook expects 3 arguments (ref, old SHA, new SHA).
Any VREF will get those three, followed by at least 4 more. Your 'update' VREF should just ignore the extra args.

  • 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

Considering the update VREF program, you could add a parameter which would allow your update script to recognize it is called in the gitolite-admin context (and should do nothing):

repo gitolite-admin
-  VREF/update/donothing    =   @all

repo @all
-  VREF/update    =   @all


来源:https://stackoverflow.com/questions/11510046/gitolite-update-hook-exclude-a-repository

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!