Don't display deleting branch button on pull request view UI if there are opened pull request use that branch as head branch. #14060

Open
opened 2025-11-02 11:01:45 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @lunny on GitHub (Jan 28, 2025).

When creating multiple pull requests with the same branch name, some of them are closed and one is opened left. Then if we click the delete branch button on the closed pull request, no error report and branch hasn't been deleted.

	// Don't cleanup when there are other PR's that use this branch as head branch.
	exist, err := issues_model.HasUnmergedPullRequestsByHeadInfo(ctx, pr.HeadRepoID, pr.HeadBranch)
	if err != nil {
		ctx.ServerError("HasUnmergedPullRequestsByHeadInfo", err)
		return
	}
	if exist {
		ctx.NotFound("CleanUpPullRequest", nil)
		return
	}
Originally created by @lunny on GitHub (Jan 28, 2025). When creating multiple pull requests with the same branch name, some of them are closed and one is opened left. Then if we click the delete branch button on the closed pull request, no error report and branch hasn't been deleted. ``` // Don't cleanup when there are other PR's that use this branch as head branch. exist, err := issues_model.HasUnmergedPullRequestsByHeadInfo(ctx, pr.HeadRepoID, pr.HeadBranch) if err != nil { ctx.ServerError("HasUnmergedPullRequestsByHeadInfo", err) return } if exist { ctx.NotFound("CleanUpPullRequest", nil) return } ```
GiteaMirror added the topic/ui label 2025-11-02 11:01:45 -06:00
Author
Owner

@silverwind commented on GitHub (Jan 28, 2025):

Should it even be possible to create multiple PRs from the same source branch? Is that allowed on GitHub?

@silverwind commented on GitHub (Jan 28, 2025): Should it even be possible to create multiple PRs from the same source branch? Is that allowed on GitHub?
Author
Owner

@lunny commented on GitHub (Jan 29, 2025):

Should it even be possible to create multiple PRs from the same source branch? Is that allowed on GitHub?

Yes. But only 1 could be opened, others should be closed.

@lunny commented on GitHub (Jan 29, 2025): > Should it even be possible to create multiple PRs from the same source branch? Is that allowed on GitHub? Yes. But only 1 could be opened, others should be closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14060