Skip to content

Commit ea64a28

Browse files
committed
Fix build of online editing patch with Gitea v1.23.6
This change will no longer be needed for v1.23.7.
1 parent e6fde8f commit ea64a28

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

patches/0012-BLENDER-Edit-file-workflow-for-creating-a-fork-and-p.patch

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,29 @@ the base repository that does the right thing.
6060
create mode 100644 templates/repo/editor/fork.tmpl
6161
create mode 100644 templates/repo/view_content.tmpl
6262

63+
diff --git a/models/git/branch.go b/models/git/branch.go
64+
index d1caa35947..9ac6c45578 100644
65+
--- a/models/git/branch.go
66+
+++ b/models/git/branch.go
67+
@@ -173,6 +173,18 @@ func GetBranch(ctx context.Context, repoID int64, branchName string) (*Branch, e
68+
return &branch, nil
69+
}
70+
71+
+// IsBranchExist returns true if the branch exists in the repository.
72+
+func IsBranchExist(ctx context.Context, repoID int64, branchName string) (bool, error) {
73+
+ var branch Branch
74+
+ has, err := db.GetEngine(ctx).Where("repo_id=?", repoID).And("name=?", branchName).Get(&branch)
75+
+ if err != nil {
76+
+ return false, err
77+
+ } else if !has {
78+
+ return false, nil
79+
+ }
80+
+ return !branch.IsDeleted, nil
81+
+}
82+
+
83+
func GetBranches(ctx context.Context, repoID int64, branchNames []string, includeDeleted bool) ([]*Branch, error) {
84+
branches := make([]*Branch, 0, len(branchNames))
85+
6386
diff --git a/models/repo/repo.go b/models/repo/repo.go
6487
index c5060a419f..e581c1a18d 100644
6588
--- a/models/repo/repo.go

0 commit comments

Comments
 (0)