From 051a9e51ec8b172ea52caeb6ba277e3be367f076 Mon Sep 17 00:00:00 2001 From: mrstanwell Date: Mon, 26 Oct 2020 18:58:25 -0500 Subject: [PATCH] Add commits to the changes list in reverse order. The gitea webhook list of pushed commits is in order from newest to oldest. If commits are appended to the changes array and returned, the last commit in the array will be the oldest commit in the push. However, buildbot treats the last change as the *most* recent. This means that unless you use 'alwaysUseLatest=True' in your Git step, the Git step will not check out the newest commit in the push. If you happen to be using 'shallow=True', this will actually cause the Git update step to fail because only the newest commit is available in a shallow checkout. This update inserts each commit in the gitea webhook call at the beginning of the array, which means buildbot sees them in chronological order. A Git step with 'shallow=True' will now succeed. --- buildbot_gitea/webhook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildbot_gitea/webhook.py b/buildbot_gitea/webhook.py index a8bacee..144d860 100644 --- a/buildbot_gitea/webhook.py +++ b/buildbot_gitea/webhook.py @@ -53,7 +53,7 @@ class GiteaHandler(BaseHookHandler): } if codebase is not None: change['codebase'] = codebase - changes.append(change) + changes.insert(0, change) return changes def process_pull_request(self, payload, event_type, codebase):