mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
introduce git-shell
This commit is contained in:
@@ -31,7 +31,7 @@ import (
|
||||
func authRequired(ctx *middleware.Context) {
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", "Basic realm=\".\"")
|
||||
ctx.Data["ErrorMsg"] = "no basic auth and digit auth"
|
||||
ctx.HTML(401, base.TplName("status/401"))
|
||||
ctx.Error(401)
|
||||
}
|
||||
|
||||
func HTTP(ctx *middleware.Context) {
|
||||
|
@@ -210,13 +210,7 @@ func PrepareViewPullInfo(ctx *middleware.Context, pull *models.Issue) *git.PullR
|
||||
}
|
||||
|
||||
if pull.HeadRepo != nil {
|
||||
headRepoPath, err := pull.HeadRepo.RepoPath()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "HeadRepo.RepoPath", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
headGitRepo, err = git.OpenRepository(headRepoPath)
|
||||
headGitRepo, err = git.OpenRepository(pull.HeadRepo.RepoPath())
|
||||
if err != nil {
|
||||
ctx.Handle(500, "OpenRepository", err)
|
||||
return nil
|
||||
@@ -496,11 +490,7 @@ func PrepareCompareDiff(
|
||||
)
|
||||
|
||||
// Get diff information.
|
||||
ctx.Data["CommitRepoLink"], err = headRepo.RepoLink()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "RepoLink", err)
|
||||
return false
|
||||
}
|
||||
ctx.Data["CommitRepoLink"] = headRepo.RepoLink()
|
||||
|
||||
headCommitID, err := headGitRepo.GetCommitIdOfBranch(headBranch)
|
||||
if err != nil {
|
||||
|
@@ -5,9 +5,8 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"github.com/Unknwon/com"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/auth"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
)
|
||||
@@ -22,8 +21,7 @@ func Wiki(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.wiki")
|
||||
ctx.Data["PageIsWiki"] = true
|
||||
|
||||
wikiPath := models.WikiPath(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)
|
||||
if !com.IsDir(wikiPath) {
|
||||
if !ctx.Repo.Repository.HasWiki() {
|
||||
ctx.HTML(200, WIKI_START)
|
||||
return
|
||||
}
|
||||
@@ -36,14 +34,31 @@ func NewWiki(ctx *middleware.Context) {
|
||||
ctx.Data["PageIsWiki"] = true
|
||||
ctx.Data["RequireSimpleMDE"] = true
|
||||
|
||||
wikiPath := models.WikiPath(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)
|
||||
if !com.IsDir(wikiPath) {
|
||||
if !ctx.Repo.Repository.HasWiki() {
|
||||
ctx.Data["title"] = "Home"
|
||||
}
|
||||
|
||||
ctx.HTML(200, WIKI_NEW)
|
||||
}
|
||||
|
||||
func NewWikiPost(ctx *middleware.Context, form auth.NewWikiForm) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page")
|
||||
ctx.Data["PageIsWiki"] = true
|
||||
ctx.Data["RequireSimpleMDE"] = true
|
||||
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(200, WIKI_NEW)
|
||||
return
|
||||
}
|
||||
|
||||
if err := ctx.Repo.Repository.AddWikiPage(form.Title, form.Content, form.Message); err != nil {
|
||||
ctx.Handle(500, "AddWikiPage", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + models.ToWikiPageName(form.Title))
|
||||
}
|
||||
|
||||
func EditWiki(ctx *middleware.Context) {
|
||||
ctx.PlainText(200, []byte(ctx.Params(":page")))
|
||||
}
|
||||
|
Reference in New Issue
Block a user