[Feature] Expose name of deleted PR branches #4886

Closed
opened 2025-11-02 06:06:13 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @ppmathis on GitHub (Feb 18, 2020).

Originally assigned to: @lunny on GitHub.

Description

When the head branch of a pull request in either state gets deleted, the pull request no longer exposes the original branch name. This is directly related to #9158, which requested tracking the ref to the tip of the deleted branch and a working commit/changes view.

I would like to suggest to also expose the name of the branch which got deleted through both UI and API instead of just showing from deleted into <target branch>. The name of the branch can usually be accessed as head.ref in the API, however the whole head property is null as soon as the branch got deleted.

Screenshots

PR with correct branch name before branch deletion

before branch deletion

PR with missing branch name after branch deletion

after branch deletion

Originally created by @ppmathis on GitHub (Feb 18, 2020). Originally assigned to: @lunny on GitHub. - Gitea version (or commit ref): 1.11.0 - Git version: 2.24.1 - Operating system: Linux (Alpine) - Database (use `[x]`): - [x] PostgreSQL - [x] MySQL - [x] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes: https://try.gitea.io/ppmathis/test/pulls/1 - [ ] No - [ ] Not relevant # Description When the head branch of a pull request in either state gets deleted, the pull request no longer exposes the original branch name. This is directly related to #9158, which requested tracking the ref to the tip of the deleted branch and a working commit/changes view. I would like to suggest to also expose the name of the branch which got deleted through both UI and API instead of just showing `from deleted into <target branch>`. The name of the branch can usually be accessed as `head.ref` in the API, however the whole `head` property is `null` as soon as the branch got deleted. # Screenshots ## PR with correct branch name before branch deletion ![before branch deletion](https://zig.pw/d367db74ea6d1d6a1d47f4ddfaa7b66527281a6b.png) ## PR with missing branch name after branch deletion ![after branch deletion](https://zig.pw/c0ea5c881a915adba24353e044ad63c3d69431a0.png)
GiteaMirror added the type/enhancement label 2025-11-02 06:06:13 -06:00
Author
Owner

@lunny commented on GitHub (Feb 19, 2020):

Because that branch maybe from another repository which deleted.

@lunny commented on GitHub (Feb 19, 2020): Because that branch maybe from another repository which deleted.
Author
Owner

@lafriks commented on GitHub (Feb 19, 2020):

We should probably display branch name even if it is deleted just without link and marked as deleted

@lafriks commented on GitHub (Feb 19, 2020): We should probably display branch name even if it is deleted just without link and marked as deleted
Author
Owner

@ppmathis commented on GitHub (Feb 19, 2020):

@lafriks That's the kind of behavior I'd expect - even when the branch or repository got deleted, the PR should still expose the original branch name through UI and API.

This also follows the implementation of all other major Git platforms including GitHub and is useful for stateless bots which can determine if a PR has been previously opened by checking for a predictable branch name.

@ppmathis commented on GitHub (Feb 19, 2020): @lafriks That's the kind of behavior I'd expect - even when the branch or repository got deleted, the PR should still expose the original branch name through UI and API. This also follows the implementation of all other major Git platforms including GitHub and is useful for stateless bots which can determine if a PR has been previously opened by checking for a predictable branch name.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4886