Integrated: 2077: GitLabRepository.recentCommitComments may miss commits on non default branch
Erik Joelsson
erikj at openjdk.org
Thu Oct 26 15:12:30 UTC 2023
On Wed, 25 Oct 2023 22:00:31 GMT, Erik Joelsson <erikj at openjdk.org> wrote:
> The recentCommitComments method on GitLabRepository is a big hack to overcome shortcomings in the GitLab APIs that has caused trouble for us at several occasions. I have now discovered another flaw in the implementation.
>
> The sub method `getCommitTitleToCommitsMap` is used to build a map of commit messages to a list of commits. On first call, it builds the bulk of the map from a local repository. This is then kept up to date by calling the rest endpoint `GET /projects/:id/repository/commits` using the `since` argument to get all commits created after the newest commit already present in the map. The problem is that this API point will only return commits on the default branch. This means that after a bot restart, any new commits on other branches will not be found when looking for commit commands.
>
> To fix this, I found the parameter `all=true` for this [endpoint](https://docs.gitlab.com/ee/api/commits.html). According to my testing, this will include commits not on the default branch while still letting us filter using `since`.
This pull request has now been integrated.
Changeset: de78b014
Author: Erik Joelsson <erikj at openjdk.org>
URL: https://git.openjdk.org/skara/commit/de78b014cd1f84a2baa6fd97818bcd8ecf047ce2
Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
2077: GitLabRepository.recentCommitComments may miss commits on non default branch
Reviewed-by: zsong
-------------
PR: https://git.openjdk.org/skara/pull/1576
More information about the skara-dev
mailing list