Enabling and disabling code review

This topic describes how to enable and disable code reviews and how to allow a self-review.

Enable code review

To enable GitCentric’s optional Gerrit Code Review functionality:

  1. The ACLs required to support code review are configured automatically for all new GitCentric installations; users upgrading to GitCentric 2013.3 may need to configure additional ACLs. As there is no one set of ACLs that is appropriate for every installation, you, as the administrator, should review these settings and adjust them as needed. See Configure ACLs for Code Review for more information.
  2. Your users must configure their clones by adding the following line to the [remote "origin"] section of each clone’s config file:
    push = refs/heads/*:refs/for/*

    This specifies the source refs/heads/* and target refs/for/* branch mapping that will be used to push changes to a special branch for code review. Users can add this line by executing the following command on each clone:

    git config remote.origin.push 'refs/heads/*:refs/for/*'
  3. Copy the commit-msg hook to the .git/hooks/ directory of each clone. For example:
    scp -p -P <port><server>:hooks/commit-msg .git/hooks/


    <port> is the SSHD listener port (typically 29418).

    <server> the host where GitCentric is installed

If you forget to copy the commit-msg hook, your push will fail. The error message you receive in this situation instructs you to copy the commit-msg hook, as described in Step 3 above. You must then execute a

git commit --amend

before trying the push again.

Back to top

Disable code review

Disabling code review is a two-step process:

  1. As the administrator, clear the Enable Code Review check box on the General panel for the repositories for which you wish to disable code review.

    For new installations of GitCentric 2013.3 and later, this action automatically configures the repository’s ACLs to enable direct push. If you have upgraded to GitCentric 2013.3 and later, this field appears as Advanced... and you must configure the repository ACLs to enable direct push manually. See Configuring GitCentric ACLs for a direct push.

  2. Individual users must remove or comment out the following line in the [remote "origin"] section of each clone’s config file:
    push = refs/heads/*:refs/for/*

Back to top

Allow self-reviews

By default, Gerrit Code Review does not allow self-reviews. If you want to configure Gerrit Code Review to allow self-reviews, you must do so in the Gerrit Code Review prolog file, rules.pl. In new installations of GitCentric 2013.3, a copy of this file is installed to the /meta/config branch of the special All- Projects repository.

Working with the rules.pl prolog file is beyond the scope of this document. Refer to the Gerrit Code Review documentation for more information: https://gerrit-review.googlesource.com/Documentation/prolog-cookbook.html

Back to top