11// Copyright 2016 The Gogs Authors. All rights reserved.
2+ // Copyright 2025 The Gitea Authors. All rights reserved.
23// SPDX-License-Identifier: MIT
34
45package repo
@@ -111,7 +112,7 @@ func getEditRepositoryOrError(ctx *context.Context, tpl templates.TplName, form
111112// and if not renders an error and returns false.
112113func canPushToEditRepository (ctx * context.Context , editRepo * repo_model.Repository , branchName , commitChoice string , tpl templates.TplName , form any ) bool {
113114 // When pushing to a fork or chosing to commit to a new branch, it should not exist yet
114- if ctx . Repo . Repository != editRepo || commitChoice == frmCommitChoiceNewBranch {
115+ if editRepo . ID != ctx . Repo . Repository . ID || commitChoice == frmCommitChoiceNewBranch {
115116 if exist , err := git_model .IsBranchExist (ctx , editRepo .ID , branchName ); err == nil && exist {
116117 ctx .Data ["Err_NewBranchName" ] = true
117118 ctx .RenderWithErr (ctx .Tr ("repo.editor.branch_already_exists" , branchName ), tpl , form )
@@ -137,8 +138,8 @@ func canPushToEditRepository(ctx *context.Context, editRepo *repo_model.Reposito
137138// to the user fork, if needed. On failure, it displays and returns an error. The
138139// branch name to be used for editing is returned.
139140func pushToEditRepositoryOrError (ctx * context.Context , editRepo * repo_model.Repository , branchName string , tpl templates.TplName , form any ) (string , error ) {
140- // If editing the repository, no need to push anything
141- if editRepo == ctx .Repo .Repository {
141+ // If editing the same repository, no need to push anything
142+ if editRepo . ID == ctx .Repo .Repository . ID {
142143 return ctx .Repo .BranchName , nil
143144 }
144145
0 commit comments