1
0
Fork 0
forked from forgejo/forgejo

GetFile api

This commit is contained in:
Unknwon 2014-11-16 21:32:26 -05:00
parent 340a4595dd
commit a0f9197b45
6 changed files with 73 additions and 26 deletions

View file

@ -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