diff options
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/editor.go | 7 | ||||
-rw-r--r-- | routers/repo/http.go | 7 | ||||
-rw-r--r-- | routers/repo/upload.go | 21 |
3 files changed, 23 insertions, 12 deletions
diff --git a/routers/repo/editor.go b/routers/repo/editor.go index 8b49a9e4..aaacd8a8 100644 --- a/routers/repo/editor.go +++ b/routers/repo/editor.go @@ -332,7 +332,12 @@ func DeleteFilePost(ctx *context.Context, form auth.DeleteRepoFileForm) { return } - if err := ctx.Repo.Repository.DeleteRepoFile(ctx.User, ctx.Repo.CommitID, branchName, treeName, form.CommitSummary); err != nil { + if err := ctx.Repo.Repository.DeleteRepoFile(ctx.User, models.DeleteRepoFileOptions{ + LastCommitID: ctx.Repo.CommitID, + Branch: branchName, + TreePath: treeName, + Message: form.CommitSummary, + }); err != nil { ctx.Handle(500, "DeleteRepoFile", err) return } diff --git a/routers/repo/http.go b/routers/repo/http.go index 89a9b1b9..80afcec4 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -195,11 +195,11 @@ func HTTP(ctx *context.Context) { if len(fields) >= 3 { oldCommitId := fields[0][4:] newCommitId := fields[1] - refName := fields[2] + refFullName := fields[2] // FIXME: handle error. if err = models.PushUpdate(models.PushUpdateOptions{ - RefName: refName, + RefFullName: refFullName, OldCommitID: oldCommitId, NewCommitID: newCommitId, PusherID: authUser.ID, @@ -207,8 +207,7 @@ func HTTP(ctx *context.Context) { RepoUserName: username, RepoName: reponame, }); err == nil { - go models.HookQueue.Add(repo.ID) - go models.AddTestPullRequestTask(authUser, repo.ID, strings.TrimPrefix(refName, git.BRANCH_PREFIX), true) + go models.AddTestPullRequestTask(authUser, repo.ID, strings.TrimPrefix(refFullName, git.BRANCH_PREFIX), true) } } 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) |