Files
Gitea/routers/api/v1/repo
Giteabot 789a3d3a4d fix(api): handle fork-only commits in compare API (#37185) (#37199)
Backport #37185 by @Mohit25022005

Fix 500 error when comparing branches across fork repositories

## Problem

The compare API returns a 500 Internal Server Error when comparing
branches where the head commit exists only in the fork repository.

## Cause

The API was using the base repository's GitRepo and repository context
when converting commits. This fails when the commit does not exist in
the base repository, resulting in a "fatal: bad object" error.

## Solution

Use the head repository and HeadGitRepo when available to ensure commits
are resolved in the correct repository context.

## Result

* Fixes "fatal: bad object" error
* Enables proper comparison between base and fork repositories
* Prevents 500 Internal Server Error

Fixes #37168

Co-authored-by: Mohit Swarnkar <mohitswarnkar13@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-04-13 18:01:44 +00:00
..
2025-02-17 12:41:03 -08:00
2026-04-03 20:03:59 +00:00
2025-02-17 12:41:03 -08:00
2025-03-31 01:53:48 -04:00
2025-02-17 12:41:03 -08:00
2025-02-17 12:41:03 -08:00
2025-02-17 12:41:03 -08:00
2025-02-16 22:13:17 -08:00
2025-02-16 22:13:17 -08:00
2025-10-10 00:39:14 +08:00
2025-03-31 01:53:48 -04:00
2025-02-17 12:41:03 -08:00
2025-02-17 12:41:03 -08:00
2026-04-03 20:03:59 +00:00
2025-02-16 22:13:17 -08:00
2025-02-16 22:13:17 -08:00
2025-04-01 17:36:46 -04:00
2025-02-16 22:13:17 -08:00