mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-01 02:30:22 +00:00
refactor(git): clarify GetBranch behavior to make it only gets an existing branch (#38662)
`GetBranch` silently returned soft-deleted branches, contradicting `IsBranchExist` and forcing callers to manually check `branch.IsDeleted` everywhere. Refactored it to `GetBranchExisting` to have a clear behavior: it only returns the existing branch. --------- Signed-off-by: Sudhanshu Singh <sudhanshuwriterblc@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -368,7 +368,7 @@ func getMergeCommit(ctx context.Context, pr *issues_model.PullRequest) (*git.Com
|
||||
|
||||
func getMergerForManuallyMergedPullRequest(ctx context.Context, pr *issues_model.PullRequest) (*user_model.User, error) {
|
||||
var errs []error
|
||||
if branch, err := git_model.GetBranch(ctx, pr.BaseRepoID, pr.BaseBranch); err != nil {
|
||||
if branch, err := git_model.GetBranchExisting(ctx, pr.BaseRepoID, pr.BaseBranch); err != nil {
|
||||
errs = append(errs, err)
|
||||
} else {
|
||||
err := branch.LoadPusher(ctx) // LoadPusher uses ghost for non-existing user
|
||||
|
||||
Reference in New Issue
Block a user