Files
gitea/routers/api/v1/repo
Giteabot 68f5e40e46 fix(api): handle missing base branch in PR commits API (#37193) (#37203)
Backport #37193 by @Mohit25022005

fix(api): handle missing base branch in PR commits API

Closes #36366

Previously, the PR commits API returned a 500 Internal Server Error
when the base branch was missing due to an unhandled git "bad revision"
error.

This change:
- Checks for base branch existence before performing git operations
- Returns 404 when the base branch does not exist
- Prevents git errors from surfacing as 500 responses

This improves API robustness and aligns behavior with expected error
handling.

Tested locally by:
- Creating a pull request
- Deleting the base branch
- Verifying that the API returns 404 instead of 500

Co-authored-by: Mohit Swarnkar <mohitswarnkar13@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2026-04-13 23:42:11 +02: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