Integrated: 1408: GitLabMergeRequest#reviews sometimes finds the wrong commit HASH

Guoxiong Li gli at openjdk.java.net
Mon May 2 16:55:46 UTC 2022


On Mon, 25 Apr 2022 09:37:04 GMT, Guoxiong Li <gli at openjdk.org> wrote:

> Hi all,
> 
> Please consider the following steps:
> 
> - the author creates "commit 1" locally (with hash "95f2d613cf392275075d7c87285845531f5fe827" [1])
> - the author pushes it and creates a merge request in the Gitlab, then the Gitlab creates "version 1" [2] (its hash is the hash of "commit 1") which has the changed files of "commit 1"
> - the author creates "commit 2" locally (with hash "99ca51edfa0063113a2236fce548ba453aee7275" [3])
> - a reviewer approves the MR with the "**version 1**" in the Gitlab. Note: the "commit 2" is not pushed now.
> - the author creates "commit 3" locally (with hash "50b119c4c325053b8151ea6e761a60d1acfbb746" [4]) Note: this step seems optional
> - the author pushes the commits and the gitlab create "version 2" [5] (its hash is the hash of "commit 3") which has the changed files of "commit 1-3"
> 
> When we use the method `GitLabMergeRequest#reviews` to get the reviews list, we can see the review hash is the hash of the "commit 2" ("99ca51edfa0063113a2236fce548ba453aee7275"). But actually, the reviewer only approved "version 1" with hash of the "commit 1" ("95f2d613cf392275075d7c87285845531f5fe827").
> 
> This patch uses the `versions` list instead of all the `commits` list to fix the issue. And when I wrote a test case to verify it, I got a NPE and filed SKARA-1409 to record it. This patch also solves SKARA-1409 so that the reviewer can run the test locally.
> 
> You can use the following config to run the test:
> 
> gitlab.user=<your username in https://gitlab.com>
> gitlab.pat=<your token in https://gitlab.com>
> 
> gitlab.uri=https://gitlab.com
> gitlab.repository=35596381
> gitlab.merge.request.id=2
> gitlab.review.hash=95f2d613cf392275075d7c87285845531f5fe827
> 
> 
> Note: this PR seems have git conflict with [SKARA-1407-PATCH](https://github.com/openjdk/skara/pull/1304). I will solve the conflict when one of them is integrated.
> 
> Thanks for taking the time to review.
> 
> Best Regards,
> -- Guoxiong
> 
> [1] https://gitlab.com/lgxbslgx/test/-/merge_requests/2/diffs?commit_id=95f2d613cf392275075d7c87285845531f5fe827
> [2] https://gitlab.com/lgxbslgx/test/-/merge_requests/2/diffs?diff_id=379883693
> [3] https://gitlab.com/lgxbslgx/test/-/merge_requests/2/diffs?commit_id=99ca51edfa0063113a2236fce548ba453aee7275
> [4] https://gitlab.com/lgxbslgx/test/-/merge_requests/2/diffs?commit_id=50b119c4c325053b8151ea6e761a60d1acfbb746
> [5] https://gitlab.com/lgxbslgx/test/-/merge_requests/2/diffs?diff_id=379907777
> 
> ---

This pull request has now been integrated.

Changeset: 079d2092
Author:    Guoxiong Li <gli at openjdk.org>
Committer: Erik Joelsson <erikj at openjdk.org>
URL:       https://git.openjdk.java.net/skara/commit/079d20928990a0a1fbaf969341b7a3210a33bd18
Stats:     20 lines in 3 files changed: 16 ins; 0 del; 4 mod

1408: GitLabMergeRequest#reviews sometimes finds the wrong commit HASH
1409: The GitLab 'list-users' api doesn't return 'email' field for normal users

Reviewed-by: erikj

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

PR: https://git.openjdk.java.net/skara/pull/1306


More information about the skara-dev mailing list