Search code examples
gitgitoliteremote-branchfast-forward

How to allow remove remote branches at gitolite and forbid non fast forward


We need to allow developers:

1) to create topic branches and save them at remote repo.

2) Do changes.

3) Do merge to 'development' branch.

4) Remove topic branch (git push origin :TestRemoteBranch).

But we would rather forbid to use non fast forward merges with usage RW permission. But this permission also forbid to to delete topic branches.

Is there any way to avoid non fast forward merges and allow to remove topic branches (not a 'development' and 'master') ?


Solution

  • When you have to do checks that the core gitolite cannot do, it is time to bring in the VREF:

    For every refex starting with VREF/FOO/ in a rule that applies to this user, a call to a program called FOO is triggered (location here).

    So in your program 'FOO', you can check if the push is a non-fast-forward one (denied) or if it is a branch deletion (allowed).