File tree Expand file tree Collapse file tree 2 files changed +3
-7
lines changed Expand file tree Collapse file tree 2 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -1015,7 +1015,7 @@ func Routes() *web.Route {
1015
1015
m .Group ("/{ref}" , func () {
1016
1016
m .Get ("/status" , repo .GetCombinedCommitStatusByRef )
1017
1017
m .Get ("/statuses" , repo .GetCommitStatusesByRef )
1018
- })
1018
+ }, context . ReferencesGitRepo () )
1019
1019
}, reqRepoReader (unit .TypeCode ))
1020
1020
m .Group ("/git" , func () {
1021
1021
m .Group ("/commits" , func () {
Original file line number Diff line number Diff line change 5
5
package utils
6
6
7
7
import (
8
+ "fmt"
8
9
"net/http"
9
10
10
11
"code.gitea.io/gitea/modules/context"
@@ -35,12 +36,7 @@ func ResolveRefOrSha(ctx *context.APIContext, ref string) string {
35
36
// GetGitRefs return git references based on filter
36
37
func GetGitRefs (ctx * context.APIContext , filter string ) ([]* git.Reference , string , error ) {
37
38
if ctx .Repo .GitRepo == nil {
38
- var err error
39
- ctx .Repo .GitRepo , err = git .OpenRepository (ctx , ctx .Repo .Repository .RepoPath ())
40
- if err != nil {
41
- return nil , "OpenRepository" , err
42
- }
43
- defer ctx .Repo .GitRepo .Close ()
39
+ return nil , "" , fmt .Errorf ("no open git repo found in context" )
44
40
}
45
41
if len (filter ) > 0 {
46
42
filter = "refs/" + filter
You can’t perform that action at this time.
0 commit comments