From 95cb7cb2add654da8b93be420014cad53ddbb1a4 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 17 Mar 2014 01:14:05 -0400 Subject: [PATCH 1/3] Nothing --- routers/repo/single.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/routers/repo/single.go b/routers/repo/single.go index 10b2ae8107..ac733b0b38 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -8,6 +8,7 @@ import ( "strings" "github.com/codegangsta/martini" + "github.com/slene/blackfriday" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/middleware" @@ -22,6 +23,7 @@ func Single(ctx *middleware.Context, params martini.Params) { params["branchname"] = "master" } + // Directory and file list. treename := params["_1"] files, err := models.GetReposFiles(params["username"], params["reponame"], params["branchname"], treename) @@ -33,6 +35,7 @@ func Single(ctx *middleware.Context, params martini.Params) { ctx.Data["Reponame"] = params["reponame"] ctx.Data["Branchname"] = params["branchname"] + // Branches. brs, err := models.GetBranches(params["username"], params["reponame"]) if err != nil { ctx.Handle(200, "repo.Single", err) @@ -50,6 +53,7 @@ func Single(ctx *middleware.Context, params martini.Params) { } } + // Latest commit. commit, err := models.GetLastestCommit(params["username"], params["reponame"]) if err != nil { ctx.Handle(200, "repo.Single", err) @@ -57,6 +61,15 @@ func Single(ctx *middleware.Context, params martini.Params) { } ctx.Data["LatestCommit"] = commit + // README. + // for _, f := range files { + // if f.Name == "README.md" { + // ctx.Data["ReadmeName"] = "README.md" + // ctx.Data["ReadmeContent"] = + // break + // } + // } + ctx.Data["Paths"] = Paths ctx.Data["Treenames"] = treenames ctx.Data["IsRepoToolbarSource"] = true From cf9fa06eae68cea08c3f2fb28644a80bb08be2c3 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 17 Mar 2014 04:33:53 -0400 Subject: [PATCH 2/3] Mirror change --- routers/repo/single.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/repo/single.go b/routers/repo/single.go index b16a706be6..75eb112503 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/codegangsta/martini" - "github.com/slene/blackfriday" + // "github.com/slene/blackfriday" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/middleware" From 0d6aafdef54183069a789054e95ffd080d1c09dd Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 17 Mar 2014 04:47:42 -0400 Subject: [PATCH 3/3] Mirror fix --- modules/middleware/repo.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go index 7a4157367e..db29bd116e 100644 --- a/modules/middleware/repo.go +++ b/modules/middleware/repo.go @@ -6,6 +6,7 @@ package middleware import ( "errors" + "strings" "github.com/codegangsta/martini" @@ -23,7 +24,7 @@ func RepoAssignment(redirect bool) martini.Handler { ) // get repository owner - ctx.Repo.IsOwner = ctx.IsSigned && ctx.User.LowerName == params["username"] + ctx.Repo.IsOwner = ctx.IsSigned && ctx.User.LowerName == strings.ToLower(params["username"]) if !ctx.Repo.IsOwner { user, err = models.GetUserByName(params["username"])