Skip to content

Unable to get commit comparasion data via API when Pull Request feature is disabled #35912

@dangjinghao

Description

@dangjinghao

Description

The API endpoint /repos/{owner}/{repo}/compare/{basehead} fails to return commit comparison data (in the same branch) when the "Pull Requests" feature is disabled for a repository. The request returns an error: {"errors":null,"message":"Can't read pulls or can't read UnitTypeCode","url":"https://xxx.com/api/swagger"}.

However, commit comparison through the web interface continues to work normally.

Test it with this command:

curl -X 'GET' 'https://demo.gitea.com/api/v1/repos/dangjinghao/test-diff/compare/5b20aef62d...main' -H 'accept: application/json'

web: https://demo.gitea.com/dangjinghao/test-diff/compare/5b20aef62d...main

Gitea Version

v1.25.1 and 1c8c565(latest commit)

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

docker

Database

SQLite

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions