Gitolite Update Hook exclude a repository

前端 未结 1 1816
鱼传尺愫
鱼传尺愫 2020-12-06 22:47

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

相关标签:
1条回答
  • 2020-12-06 23:33

    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
    
    0 讨论(0)
提交回复
热议问题