mirror of
https://github.com/AdaCore/git-hooks.git
synced 2026-02-12 12:43:11 -08:00
This change is mostly a cleanup which simplifies a bit the iteration over the list of commits for which to perform the various checks, by having that information provided via an attribute whose name is very specific about the semantics of what to use that list for. This was motivated by an issue we discovered recently where we forgot to exclude some commits when calling the commit-extra-checker hook. This happened because, no matter how simple the algorithm for computing the list of commits to check was, that simple algorithm was duplicated in many places. This avoids that, in the hopes that this will prevent this same kind of issues again in the future. Another way to view the benefits of this cleanup is that this will help ensure consistency in terms of the list of commits to which the various checks are applied. Note that we could have logically split this patch into two steps, with the first step simply renaming the "added_commits" attribute into "new_commits_for_ref", and then a second step introducing the "commits_to_check" attribute. In the end, both are combined in a single commit because it seems easier to review every location where the "added_commits" attribute was used, and make sure from the context that the correct list of commits was chosen in each instance the "added_commits" list used to be referenced. Otherwise, it's harder to review the second commit adding the "commits_to_check" attribute, because the reviewer then has to audit the entire set of sources himself in order to make sure no spot was missed. No actual behavior change should result from this change, and therefore no test is being added. Change-Id: I93c206968800dc738d3ebe4f5424f9201875383b TN: T929-030