How to allow remove remote branches at gitolite and forbid non fast forward
-
30-06-2021 - |
Question
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 calledFOO
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).
OTHER TIPS
I resolved this by gitolite v2 (as disabling rewind on main branches - master and development):
repo file-formats RW master = @all - master = @all RW development = @all - development = @all RW+ = @all config gitolite-options.deny-repo = 1