Skip to content

DiffRefs not populating for Merge Requests List

For my GitLab Plugin for Jenkins,

Raising this issue based on discussions here. The following API calls are made in Java using gitlab4j.

I need DiffRefs of Merge Request. Although DiffRefs get populated for single MergeRequest call e.g.

gitLabApi.getMergeRequestApi().getMergeRequest(projectpath, iid);

But it doesn't work when called for a list of Merge Requests. The DiffRefs field is returned null e.g.

for(final MergeRequest m : gitLabApi.getMergeRequestApi().getMergeRequests(projectpath, Constants.MergeRequestState.OPENED)) {
        System.out.println(m);
        System.out.println("-----------------");
    }

For getting the DiffRefs I need to perform an extra api call inside the for loop, e.g.

for(final MergeRequest m : gitLabApi.getMergeRequestApi().getMergeRequests(projectpath, Constants.MergeRequestState.OPENED)) {
        System.out.println(gitLabApi.getMergeRequestApi().getMergeRequest(project, m.getIid()));
        System.out.println("-----------------");
    }

But this might be a little resource intensive. Want to know if there is a reason why diffRefs are not populated when api calls for a list of MRs.

Thanks.