Please consider the following steps:
- the author creates "commit 1" locally
- the author pushes it and creates a merge request, the Gitlab creates "version 1" (its hash is the hash of "commit 1") which has "commit 1"
- the author creates "commit 2" locally
- a reviewer approves the MR with the "version 1"
- the author create "commit 3" locally
- the author pushes the commits and the gitlab create "version 2" (its hash is the hash of "commit 3") which has "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". But actually, the reviewer only approved "version 1" with "commit 1".
We should use the `versions` instead of the `commits` to search the hash of the approval.
The wrong code is shown below for convenience.
```
// GitLabMergeRequest#reviews
var commits = request.get("commits").execute().stream()
.map(JSONValue::asObject)
.map(obj -> {
var ret = new CommitDate();
ret.hash = new Hash(obj.get("id").asString());
ret.date = ZonedDateTime.parse(obj.get("created_at").asString());
return ret;
})
.collect(Collectors.toCollection(ArrayList::new));
```
- the author creates "commit 1" locally
- the author pushes it and creates a merge request, the Gitlab creates "version 1" (its hash is the hash of "commit 1") which has "commit 1"
- the author creates "commit 2" locally
- a reviewer approves the MR with the "version 1"
- the author create "commit 3" locally
- the author pushes the commits and the gitlab create "version 2" (its hash is the hash of "commit 3") which has "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". But actually, the reviewer only approved "version 1" with "commit 1".
We should use the `versions` instead of the `commits` to search the hash of the approval.
The wrong code is shown below for convenience.
```
// GitLabMergeRequest#reviews
var commits = request.get("commits").execute().stream()
.map(JSONValue::asObject)
.map(obj -> {
var ret = new CommitDate();
ret.hash = new Hash(obj.get("id").asString());
ret.date = ZonedDateTime.parse(obj.get("created_at").asString());
return ret;
})
.collect(Collectors.toCollection(ArrayList::new));
```
- relates to
-
SKARA-1407 GitLabMergeRequest#filesUrl returns wrong result
-
- Resolved
-
-
SKARA-1409 The GitLab 'list-users' api doesn't return 'email' field for normal users
-
- Resolved
-