forked from forgejo/forgejo
GetFile api
This commit is contained in:
parent
340a4595dd
commit
a0f9197b45
6 changed files with 73 additions and 26 deletions
|
@ -122,6 +122,17 @@ func RepoRef() macaron.Handler {
|
|||
err error
|
||||
)
|
||||
|
||||
// For API calls.
|
||||
if ctx.Repo.GitRepo == nil {
|
||||
repoPath := models.RepoPath(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)
|
||||
gitRepo, err := git.OpenRepository(repoPath)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "RepoRef Invalid repo "+repoPath, err)
|
||||
return
|
||||
}
|
||||
ctx.Repo.GitRepo = gitRepo
|
||||
}
|
||||
|
||||
// Get default branch.
|
||||
if len(ctx.Params("*")) == 0 {
|
||||
refName = ctx.Repo.Repository.DefaultBranch
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue