diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/serve.go | 11 | ||||
-rw-r--r-- | cmd/update.go | 15 | ||||
-rw-r--r-- | cmd/web.go | 23 |
3 files changed, 27 insertions, 22 deletions
diff --git a/cmd/serve.go b/cmd/serve.go index d8e77dcd..305aaa64 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -104,8 +104,15 @@ func handleUpdateTask(uuid string, user, repoUser *models.User, reponame string, return } - if err = models.Update(task.RefName, task.OldCommitID, task.NewCommitID, - user.Name, repoUser.Name, reponame, user.Id); err != nil { + if err = models.PushUpdate(models.PushUpdateOptions{ + RefName: task.RefName, + OldCommitID: task.OldCommitID, + NewCommitID: task.NewCommitID, + PusherID: user.Id, + PusherName: user.Name, + RepoUserName: repoUser.Name, + RepoName: reponame, + }); err != nil { log.GitLogger.Error(2, "Update: %v", err) } diff --git a/cmd/update.go b/cmd/update.go index 4cd62a7f..30f778f2 100644 --- a/cmd/update.go +++ b/cmd/update.go @@ -28,18 +28,19 @@ func runUpdate(c *cli.Context) { if c.IsSet("config") { setting.CustomConf = c.String("config") } - cmd := os.Getenv("SSH_ORIGINAL_COMMAND") - if cmd == "" { - return - } setup("update.log") + if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 { + log.GitLogger.Trace("SSH_ORIGINAL_COMMAND is empty") + return + } + args := c.Args() if len(args) != 3 { - log.GitLogger.Fatal(2, "received less 3 parameters") - } else if args[0] == "" { - log.GitLogger.Fatal(2, "refName is empty, shouldn't use") + log.GitLogger.Fatal(2, "Arguments received are not equal to three") + } else if len(args[0]) == 0 { + log.GitLogger.Fatal(2, "First argument 'refName' is empty, shouldn't use") } task := models.UpdateTask{ @@ -34,7 +34,6 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" - "github.com/gogits/gogs/modules/avatar" "github.com/gogits/gogs/modules/bindata" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware" @@ -81,7 +80,7 @@ func checkVersion() { // Check dependency version. checkers := []VerChecker{ {"github.com/go-xorm/xorm", func() string { return xorm.Version }, "0.4.4.1029"}, - {"github.com/go-macaron/binding", binding.Version, "0.1.0"}, + {"github.com/go-macaron/binding", binding.Version, "0.2.1"}, {"github.com/go-macaron/cache", cache.Version, "0.1.2"}, {"github.com/go-macaron/csrf", csrf.Version, "0.0.3"}, {"github.com/go-macaron/i18n", i18n.Version, "0.2.0"}, @@ -89,8 +88,8 @@ func checkVersion() { {"github.com/go-macaron/toolbox", toolbox.Version, "0.1.0"}, {"gopkg.in/ini.v1", ini.Version, "1.8.4"}, {"gopkg.in/macaron.v1", macaron.Version, "0.8.0"}, - {"github.com/gogits/git-module", git.Version, "0.2.4"}, - {"github.com/gogits/go-gogs-client", gogs.Version, "0.7.2"}, + {"github.com/gogits/git-module", git.Version, "0.2.5"}, + {"github.com/gogits/go-gogs-client", gogs.Version, "0.7.3"}, } for _, c := range checkers { if !version.Compare(c.Version(), c.Expected, ">=") { @@ -245,11 +244,6 @@ func runWeb(ctx *cli.Context) { }) // ***** END: User ***** - // Gravatar service. - avt := avatar.CacheServer("public/img/avatar/", "public/img/avatar_default.jpg") - os.MkdirAll("public/img/avatar/", os.ModePerm) - m.Get("/avatar/:hash", avt.ServeHTTP) - adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true}) // ***** START: Admin ***** @@ -350,11 +344,14 @@ func runWeb(ctx *cli.Context) { m.Get("/members/action/:action", org.MembersAction) m.Get("/teams", org.Teams) + }, middleware.OrgAssignment(true)) + + m.Group("/:org", func() { m.Get("/teams/:team", org.TeamMembers) m.Get("/teams/:team/repositories", org.TeamRepositories) m.Route("/teams/:team/action/:action", "GET,POST", org.TeamsAction) m.Route("/teams/:team/action/repo/:action", "GET,POST", org.TeamsRepoAction) - }, middleware.OrgAssignment(true)) + }, middleware.OrgAssignment(true, false, true)) m.Group("/:org", func() { m.Get("/teams/new", org.NewTeam) @@ -473,7 +470,7 @@ func runWeb(ctx *cli.Context) { m.Post("/delete", repo.DeleteRelease) }, reqRepoAdmin, middleware.RepoRef()) - m.Combo("/compare/*", repo.MustEnablePulls).Get(repo.CompareAndPullRequest). + m.Combo("/compare/*", repo.MustAllowPulls).Get(repo.CompareAndPullRequest). Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost) }, reqSignIn, middleware.RepoAssignment(), repo.MustBeNotBare) @@ -506,7 +503,7 @@ func runWeb(ctx *cli.Context) { m.Get("/commits", middleware.RepoRef(), repo.ViewPullCommits) m.Get("/files", middleware.RepoRef(), repo.ViewPullFiles) m.Post("/merge", reqRepoAdmin, repo.MergePullRequest) - }, repo.MustEnablePulls) + }, repo.MustAllowPulls) m.Group("", func() { m.Get("/src/*", repo.Home) @@ -516,7 +513,7 @@ func runWeb(ctx *cli.Context) { m.Get("/forks", repo.Forks) }, middleware.RepoRef()) - m.Get("/compare/:before([a-z0-9]{40})...:after([a-z0-9]{40})", repo.CompareDiff) + m.Get("/compare/:before([a-z0-9]{40})\\.\\.\\.:after([a-z0-9]{40})", repo.CompareDiff) }, ignSignIn, middleware.RepoAssignment(), repo.MustBeNotBare) m.Group("/:username/:reponame", func() { m.Get("/stars", repo.Stars) |