It makes it easier to separate this part of the code from the rest,
and this is preparation for skipping this part if the repository
has been configured to do so.
For Q608-030.
The latter is really all-encompassing, and expected to disable all
precommit checks. And it would be used in the scenario that lead
to the creation of the hooks.no-gitreview-check config. So it should
be good enough for now to simply rely on hooks.no-precommit-check.
For Q802-008.
This patch rejects a branch creation if it looks like the user
forgot to update the gerrit.defaultbranch config in the .gitreview
file. This is to prevent some fairly confusing behavior when
we forgot..,
For P426-022
This commit introduces a new hooks.frozen-ref (tuple) config which
allows a user, via an update of the refs/meta/config::project.config
file, to disallow changes to any reference.
Typically, this would be used when a given branch gets retired,
to prevent people from pushing updates to is, thinking that they
are updating an active branch, when in fact the branch is no longer
being used.
The same effect could be achieved using the "retired/*" namespace,
but this approach was deemed easier to manage for certain users
(and the latter approach was designed before users had access to
the hook's config file).
For Q314-009.
For instance, instead of defining hooks.no-emails as...
no-emails = refs/heads/topic*,refs/heads/wip*
... one can now say:
no-emails = refs/heads/topic*
no-emails = refsheads/wip*
For Q314-009.
Prior to this patch, the git-hooks were assuming that all options
in the project.config file were entirely contained within a single
line. This patch lifts this limitation.
For Q119-043.
This is a performance enhancement which reduces the number of calls
to style_checker to, at most, once per commit. For repositories which
are configured to combine the commits for style-checking, the
style_checker should only be called once at most.
In terms of performance gains, the new approach increases
the performance by a factor of about 5 to 8 (measured using
a set of 10, 100, 1000 and 4500 files, the latter being the typical
commit in the GDB repository when adjusting the copyright year in
all GDB sources).
Roughly speaking, on an Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz,
style-checking 4,500 text files, for which no check is actually
performed, took 31 seconds instead of 226 seconds. Using 4,500 Ada
files, for which we actually run the GNAT compiler and perform some
rulific checks, the new approach took 61 seconds instead of 230
seconds. The relative gain in the Ada case may appear to decrease
with the number of files to check, but 61 secs instead of 230 secs
is the difference between completing before the gerrit timeout
(around 2 minutes) or being aborted by the gerrit timeout.
For Q530-009.
Given the recent change where we're preparing for calling the style_checker
only once for all files at once, the hooks are no longer printing
the name of the file that failed style checking. For that, we rely
on the style_checker itself. What this commit does is adjusting
the fake cvs_check scripts we use as the style checker within
this testsuite to mimick the desired behavior a little more.
Rather than just printing an error message, we print the name
of the file that triggered the error as well.
Related to Q530-009.
This is preparation work towards calling the style checker only once
for an entire commit, rather than once per file.
This commit also adds a new testcase, allowing the code coverage to
remain at 100%.
For Q530-009.
Thanks to the transition to the new style checker, we can now
call it directly with the module name, without having to fake
the SVN path to that module.
Part of NA17-007.
The team felt that requiring the extra '(' and ')' around the keywords
we can use in revision logs aren't really all that necessary, so
this patch makes it all consistent within the git-hooks, but
the svn hooks as well.
This patch also adjusts the two corresponding tests
(M424-008__no_rh_check_keyword, and P426-035__no_precommit_check_in_rh)
to verify that the relaxed requirement is actually relaxed.
Part of OA23-034.