Skip to content

merge_request_diff.rb: Populate CommitCollection from target project/branch

What does this MR do?

Currently the commitsWithoutMergeCommits node list of the graphql mergeRequest field is not populated if the source project of the MR is not accessible by the user. This is wrong and a break from the behaviour of the existing REST API.

Fix this in the MergeRequestDiff object's load_commits() function by populating the CommitCollection from the target project and branch instead. Otherwise the collection is determined to be inaccessible to the user even when they have full access to the project the MR is opened in.

Fixes: #335687 (closed)

How to setup and validate locally

See #335687 (closed) for reproducer steps.

Edited by Patrick Talbert

Merge request reports