commit | 59e701d960f7cce36522230b994bb19169081146 | [log] [tgz] |
---|---|---|
author | Luca Milanesio <luca.milanesio@gmail.com> | Wed Sep 15 21:35:53 2021 +0100 |
committer | Luca Milanesio <luca.milanesio@gmail.com> | Wed Sep 22 22:18:46 2021 +0000 |
tree | f5e2cd03df863ddefae89fe58e4f0652dc18bde7 | |
parent | 770f3a53fe8a980d39af5aceafd3dbb3ac41c81a [diff] |
Reuse existing Repository for refs filtering The git-refs-filter plugin is meant to be used for repositories that may have millions of refs associated with hundreds of thousands of changes. Opening and closing the repository for every change to be filtered has a significant performance degradation which could also bring the entire clone to fail for timeout. The Repository object is always the same for the filtering of all changes and therefore it makes sense to reuse it instead of wasting CPU cycles in the open/close of the same repository million of times. Change-Id: I0e15c6ce53db56486a29a3c009f724f5a92ff300
Gerrit lib module to allow filtering out refs in the Git advertizing protocol phase.
Build this module as it was a Gerrit plugin:
git-refs-filter
directory to Gerrit /plugins/git-refs-filter
bazel build plugins/git-refs-filter
bazel test plugins/git-refs-filter:git_refs_filter_tests
git-refs-filter.jar
module is generated under /bazel-genfiles/plugins/git-refs-filter/
Copy git-refs-filter.jar
library to Gerrit /lib
and add the following one extra settings to gerrit.config
:
[gerrit] installModule = com.googlesource.gerrit.modules.gitrefsfilter.RefsFilterModule
The refsfilter module defines a new global capability called “Filter out closed changes refs”. By default the capability isn't assigned to any user or group, thus the module installation has no side effects.
Filtering a closed change refs has the following meaning:
To enable a group of users of getting a “filtered list” of refs (e.g. CI jobs):
NOTE Gerrit makes a super-simplified ACL evaluation if all the projects are globally readable (e.g. project has a READ rule to refs/*). To enable the closed changes filtering you need to disable any global read rule for the group that needs refs filtering.