diff options
author | Unknwon <u@gogs.io> | 2016-08-16 23:06:38 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-16 23:06:38 -0700 |
commit | a00c932bbc5a76ba9b0457d7d20cd1d5fc185b3d (patch) | |
tree | 8992a05aa3d7a72ea8e61047efc8cbab47944f33 /routers/repo/upload.go | |
parent | 6f9a95f83020e215ebe3942bd541da34791dd043 (diff) |
General code quality improvement
Diffstat (limited to 'routers/repo/upload.go')
-rw-r--r-- | routers/repo/upload.go | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/routers/repo/upload.go b/routers/repo/upload.go index a7402cfc..c77bdce8 100644 --- a/routers/repo/upload.go +++ b/routers/repo/upload.go @@ -5,17 +5,19 @@ package repo import ( + "fmt" + "net/http" + "path" "strings" - "fmt" + git "github.com/gogits/git-module" + "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" - "net/http" - "path" ) const ( @@ -162,12 +164,17 @@ func UploadFilePost(ctx *context.Context, form auth.UploadRepoFileForm) { if branchName != oldBranchName { oldCommitID = "0000000000000000000000000000000000000000" // New Branch so we use all 0s } - if err := models.CommitRepoAction(ctx.User.ID, ctx.Repo.Owner.ID, ctx.User.LowerName, ctx.Repo.Owner.Email, - ctx.Repo.Repository.ID, ctx.Repo.Owner.LowerName, ctx.Repo.Repository.Name, "refs/heads/"+branchName, pc, - oldCommitID, newCommitID); err != nil { + if err := models.CommitRepoAction(models.CommitRepoActionOptions{ + PusherName: ctx.User.Name, + RepoOwnerID: ctx.Repo.Owner.ID, + RepoName: ctx.Repo.Owner.Name, + RefFullName: git.BRANCH_PREFIX + branchName, + OldCommitID: oldCommitID, + NewCommitID: newCommitID, + Commits: pc, + }); err != nil { log.Error(4, "models.CommitRepoAction(branch = %s): %v", branchName, err) } - models.HookQueue.Add(ctx.Repo.Repository.ID) } ctx.Redirect(ctx.Repo.RepoLink + "/src/" + branchName + "/" + treeName) |