2

In a gitolite setup, is there a way to allow some commits to bypass some restrictions?

More specifically, I want to deny some actions (like creating a branch) to prevent doing so by accident, these restrictions are done in gitolite.conf file and I know how to do so, but additionally I want users to be able to bypass some of these restrictions if they are really sure (e.g. by including --force in commit message).

Is this possible trough gitolite configuration itself or a plugin? If not, how can I modify gitolite hooks to enable such feature?

Amir Ali Akbari
  • 5,973
  • 5
  • 35
  • 47
  • I think you might be able to do this, but based on the commit messages? Anyway I think you might be brewing a problem. What's the big deal if someone creates a branch by mistake? You. Have a VCS to be able to go back in time if something is wrong. – Augusto Oct 27 '12 at 11:35
  • creating branch was just an example, consider a rule like denying merge commits in a branch, which should be checked most of the times, but there are cases that someone has done this by mistake and redoing all of it to correct history (possibly rebase, solve conflicts, etc.) takes a lot of time. – Amir Ali Akbari Oct 27 '12 at 11:41
  • and using something like '--force' in commit message was just an idea to show that the commit should bypass those second-hand restrictions – Amir Ali Akbari Oct 27 '12 at 11:42

1 Answers1

1

For any custom-designed restriction you might want to enforce, you could consider using, especially with gitoliteV3, the VREFS or "Virtual References.

Those are script which can allow or deny a git command based on a variety of criteria, including commit message (as I recently illustrated in "git gitolite (v3) pre-receive hook for all commit messages").

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250