diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/repofiles/action.go | 6 | ||||
-rw-r--r-- | modules/repofiles/action_test.go | 20 |
2 files changed, 15 insertions, 11 deletions
diff --git a/modules/repofiles/action.go b/modules/repofiles/action.go index ac5df9a14f..9467e4fb72 100644 --- a/modules/repofiles/action.go +++ b/modules/repofiles/action.go @@ -193,12 +193,16 @@ func CommitRepoAction(opts CommitRepoActionOptions) error { } if isHookEventPush { + commits, err := opts.Commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) + if err != nil { + return err + } if err = models.PrepareWebhooks(repo, models.HookEventPush, &api.PushPayload{ Ref: opts.RefFullName, Before: opts.OldCommitID, After: opts.NewCommitID, CompareURL: setting.AppURL + opts.Commits.CompareURL, - Commits: opts.Commits.ToAPIPayloadCommits(repo.HTMLURL()), + Commits: commits, Repo: apiRepo, Pusher: apiPusher, Sender: apiPusher, diff --git a/modules/repofiles/action_test.go b/modules/repofiles/action_test.go index 322c668dad..9ae1042e22 100644 --- a/modules/repofiles/action_test.go +++ b/modules/repofiles/action_test.go @@ -29,7 +29,7 @@ func TestCommitRepoAction(t *testing.T) { }{ { userID: 2, - repositoryID: 2, + repositoryID: 16, commitRepoActionOptions: CommitRepoActionOptions{ RefFullName: "refName", OldCommitID: "oldCommitID", @@ -37,20 +37,20 @@ func TestCommitRepoAction(t *testing.T) { Commits: &models.PushCommits{ Commits: []*models.PushCommit{ { - Sha1: "abcdef1", + Sha1: "69554a6", CommitterEmail: "user2@example.com", - CommitterName: "User Two", - AuthorEmail: "user4@example.com", - AuthorName: "User Four", - Message: "message1", + CommitterName: "User2", + AuthorEmail: "user2@example.com", + AuthorName: "User2", + Message: "not signed commit", }, { - Sha1: "abcdef2", + Sha1: "27566bd", CommitterEmail: "user2@example.com", - CommitterName: "User Two", + CommitterName: "User2", AuthorEmail: "user2@example.com", - AuthorName: "User Two", - Message: "message2", + AuthorName: "User2", + Message: "good signed commit (with not yet validated email)", }, }, Len: 2, |