Some of Gitea's less common features are not in its API and are very hard to implement yourself. #14295

Open
opened 2025-11-02 11:08:59 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @Flint01686 on GitHub (Mar 24, 2025).

Feature Description

In Gitea, it's possible to find out in which branches a particular commit exists, based on its hash. By inspecting the commit page, I found a corresponding route: http://[host]/[repoOwnerOrOrg]/[repoName]/commit/[123hashCommit321]/load-branches-and-tags. This route returns a JSON payload containing the necessary information. However, I haven't found similar functionality in the Gitea API that would even partially solve this problem. Perhaps I overlooked something; please correct me if I'm wrong.

Currently, to find out which branches contain a commit, I see no alternative other than iterating through all the repo's branches and checking for the commit's existence in each one, or using something like Selenium to retrieve the JSON from my locally deployed Gitea directly via the route (i.e., get the information directly from the route instead of through the API).

I hope I've misunderstood the API's capabilities as described in the documentation, because both of the solutions mentioned above sound ridiculous. I'd like to find a proper solution without iteration or Selenium. I'd like it to be accessible via API.

Screenshots

Image

Image

Originally created by @Flint01686 on GitHub (Mar 24, 2025). ### Feature Description In Gitea, it's possible to find out in which branches a particular commit exists, based on its hash. By inspecting the commit page, I found a corresponding route: http://[host]/[repoOwnerOrOrg]/[repoName]/commit/[123hashCommit321]/load-branches-and-tags. This route returns a JSON payload containing the necessary information. However, I haven't found similar functionality in the Gitea API that would even partially solve this problem. Perhaps I overlooked something; please correct me if I'm wrong. Currently, to find out which branches contain a commit, I see no alternative other than iterating through all the repo's branches and checking for the commit's existence in each one, or using something like Selenium to retrieve the JSON from my locally deployed Gitea directly via the route (i.e., get the information directly from the route instead of through the API). I hope I've misunderstood the API's capabilities as described in the documentation, because both of the solutions mentioned above sound ridiculous. I'd like to find a proper solution without iteration or Selenium. I'd like it to be accessible via API. ### Screenshots ![Image](https://github.com/user-attachments/assets/9f973833-fa57-4b2a-a736-1cf444289aaf) ![Image](https://github.com/user-attachments/assets/a12e5a3b-0ada-4907-8d61-3b99909a213b)
GiteaMirror added the type/proposal label 2025-11-02 11:08:59 -06:00
Author
Owner

@eeyrjmr commented on GitHub (Mar 25, 2025):

no need to iterate, just do:

git branch -a --contains <commit>

@eeyrjmr commented on GitHub (Mar 25, 2025): no need to iterate, just do: `git branch -a --contains <commit>`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14295