REST api "repos/{owner}/{repo}/compare/{basehead}" cannot compare between commits #13390

Closed
opened 2025-11-02 10:40:58 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @Zarklord on GitHub (Aug 15, 2024).

Description

The documentation for that specific rest API describes the {basehead} as the following:

compare two branches or commits

but, in reality, it's only capable of comparing between two branches/tags, because the source code explicitly checks if the base is a branch or a tag and if the head is a branch of a tag which prevents you from comparing commits like the api's description implies you can, and that you can compare between commits on the web interface

(also as an aside, but the expected format of {basehead} isn't stated anywhere, nor is there an example for you to infer it)

Gitea Version

1.22.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

N/A

Screenshots

image

Git Version

N/A

Operating System

ubuntu 22.04

How are you running Gitea?

docker gitea/gitea:1.22.1@sha256:1b9dcae47e821b8dd75c1e48d13677c428624d02e683badb461e4947300e7d19

Database

PostgreSQL

Originally created by @Zarklord on GitHub (Aug 15, 2024). ### Description The [documentation](https://docs.gitea.com/api/1.22/#tag/repository/operation/repoCompareDiff) for that specific rest API describes the `{basehead}` as the following: > compare two branches or commits but, in reality, it's only capable of comparing between two branches/tags, because the source code explicitly checks if the [base is a branch or a tag](https://github.com/go-gitea/gitea/blob/main/routers/api/v1/repo/pull.go#L1105) and if the [head is a branch of a tag](https://github.com/go-gitea/gitea/blob/main/routers/api/v1/repo/pull.go#L1169) which prevents you from comparing commits like the api's description implies you can, and that you can compare between commits on the web interface (also as an aside, but the expected format of `{basehead}` isn't stated anywhere, nor is there an example for you to infer it) ### Gitea Version 1.22.1 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist N/A ### Screenshots ![image](https://github.com/user-attachments/assets/381af527-6b2e-4550-860d-f54c2ee11f0f) ### Git Version N/A ### Operating System ubuntu 22.04 ### How are you running Gitea? docker `gitea/gitea:1.22.1@sha256:1b9dcae47e821b8dd75c1e48d13677c428624d02e683badb461e4947300e7d19` ### Database PostgreSQL
GiteaMirror added the topic/apitype/bug labels 2025-11-02 10:40:58 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Dec 12, 2024):

-> Make API "compare" accept commit IDs #32801

@wxiaoguang commented on GitHub (Dec 12, 2024): -> Make API "compare" accept commit IDs #32801
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13390