diff --git a/server/remote/gitea/helper.go b/server/remote/gitea/helper.go index 5f09bc56d..ed28a5f89 100644 --- a/server/remote/gitea/helper.go +++ b/server/remote/gitea/helper.go @@ -112,14 +112,12 @@ func buildFromPush(hook *pushHook) *model.Build { func getChangedFilesFromPushHook(hook *pushHook) []string { files := make([]string, 0) - if len(hook.Commits) == 0 { - return files + for _, c := range hook.Commits { + files = append(files, c.Added...) + files = append(files, c.Removed...) + files = append(files, c.Modified...) } - files = append(files, hook.Commits[0].Added...) - files = append(files, hook.Commits[0].Removed...) - files = append(files, hook.Commits[0].Modified...) - return files } diff --git a/server/remote/gitea/helper_test.go b/server/remote/gitea/helper_test.go index 3e999205f..9d8aedfb5 100644 --- a/server/remote/gitea/helper_test.go +++ b/server/remote/gitea/helper_test.go @@ -106,6 +106,7 @@ func Test_parse(t *testing.T) { g.Assert(build.Message).Equal(hook.Commits[0].Message) g.Assert(build.Avatar).Equal("http://1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87") g.Assert(build.Author).Equal(hook.Sender.Login) + g.Assert(build.ChangedFiles).Equal([]string{"CHANGELOG.md", "app/controller/application.rb"}) }) g.It("Should return a Repo struct from a push hook", func() {