Skip to content

GitlabAPI#getCommits returns branch commits #259

Closed

Description

@maxim5

There is an API to get merge request commits, but instead source branch commits are returned, which is not the same.

API version 1.2.8

Activity

  1. maxim5 commented on Oct 16, 2017

    @maxim5
    Author

    Looks like v3 API is very different from v4: /commits and /changes accept merge request id, not iid.
    Unfortunately, GitlabAPI hard-codes v3 and is not extensible, so I can't use v4 with current implementation.

  2. Fractaliste commented on Dec 3, 2018

    @Fractaliste

    I got the same when getting commit from a Tag. It's quiet annoying because it prevents me to get author's name...

  3. rkpatel7 commented on Oct 11, 2019

    @rkpatel7
    Contributor

    Since #333, it's been possible to pass in an apiNameSpace but the default is now v4.

    Regardless, in both v3 and v4, Gitlab provides a way to get commits associated with an MR:

    Given that it's very similar other than merge_request_id vs merge_request_iid and all the other methods in this library right now are using iid, I think it's safe to update the implementation for getCommits to use the correct endpoint.

    I'll go ahead and submit a PR for this as I have had to implement a workaround for this in the past and would now like to fix it in this library instead of using my workaround. @timols if you have any thoughts/concerns, please let me know.

    @Fractaliste I would suggest opening a separate issue for getting commits from a Tag since I would like to keep the scope of this change limited to the original issue.

  4. added a commit that references this issue on Oct 14, 2019
    5f7cb84
  5. added a commit that references this issue on Oct 18, 2019
    2863c78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions