Bitbucket API List commits not working as expected.

Sebastian Rincon
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 19, 2024

Bitbucket API
List commits not working as expected.

 

GET /repositories/{workspace}/{repo_slug}/commits/?include=foo&include=bar&exclude=fu&exclude=fubar

Returns all commits that are on refs foo or bar, but not on fu or fubar (similar to git log foo bar ^fu ^fubar).

 

https://api.bitbucket.org/2.0/repositories/some-org/some-repo/commits?include=main
Works as expected. It returns:

 

{

    "values": [

        {

            "type": "commit",

            "hash": "some-hash",
            ...
}

 

ttps://api.bitbucket.org/2.0/repositories/some-org/some-repo/commits?include=main&include=master
Does not work. Should return all commits that match the branches, ignore if branch does not exists. Currently it returns:

 

{

    "type": "error",

    "error": {

        "message": "Commit not found",

        "data": {

            "shas": [

                "master"

            ]

        }

    },

    "data": {

        "shas": [

            "master"

        ]

    }

}

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 22, 2024

G'day @Sebastian Rincon !

Welcome to the Bitbucket Cloud community! :)

I have been able to reproduce the same behaviour as you have described - indeed, if one of the two branches does not exist, an error is returned rather than results being returned for the existing branch.

I've raised a feature request on your behalf with our developers to improve our API's filtering abilities - please feel free to Watch this to receive future updates related to it and Vote for it to improve its visibility with regard to customer demand:

 

Cheers!

- Ben (Bitbucket Cloud Support)

 

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events