RFR: 2077: GitLabRepository.recentCommitComments may miss commits on non default branch

Zhao Song zsong at openjdk.org
Wed Oct 25 22:31:17 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`.

Marked as reviewed by zsong (Reviewer).

-------------

PR Review: https://git.openjdk.org/skara/pull/1576#pullrequestreview-1698343596


More information about the skara-dev mailing list