diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-18 12:10:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-18 12:10:26 +0300 |
commit | 3b4c0d27d5ad32fecdcc95e86bf919fc13830c5b (patch) | |
tree | 98001b846bd52e10a3aa0fd9adff82b19ae89847 /app/services/git | |
parent | 514ace363222f19595375f59b123b5e27c2b9b8a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/git')
-rw-r--r-- | app/services/git/base_hooks_service.rb | 5 | ||||
-rw-r--r-- | app/services/git/branch_hooks_service.rb | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/app/services/git/base_hooks_service.rb b/app/services/git/base_hooks_service.rb index 1eb54e13522..aee2f685e97 100644 --- a/app/services/git/base_hooks_service.rb +++ b/app/services/git/base_hooks_service.rb @@ -25,6 +25,7 @@ module Git raise NotImplementedError, "Please implement #{self.class}##{__method__}" end + # The changeset, ordered with the newest commit last def commits raise NotImplementedError, "Please implement #{self.class}##{__method__}" end @@ -132,10 +133,10 @@ module Git end def event_push_data - # We only need the last commit for the event push, and we don't + # We only need the newest commit for the event push, and we don't # need the full deltas either. @event_push_data ||= Gitlab::DataBuilder::Push.build( - **push_data_params(commits: commits.last, with_changed_files: false) + **push_data_params(commits: limited_commits.last, with_changed_files: false) ) end diff --git a/app/services/git/branch_hooks_service.rb b/app/services/git/branch_hooks_service.rb index 9738615c804..7a22d7ffcdf 100644 --- a/app/services/git/branch_hooks_service.rb +++ b/app/services/git/branch_hooks_service.rb @@ -21,8 +21,9 @@ module Git def commits strong_memoize(:commits) do if creating_default_branch? - # The most recent PROCESS_COMMIT_LIMIT commits in the default branch - project.repository.commits(newrev, limit: PROCESS_COMMIT_LIMIT) + # The most recent PROCESS_COMMIT_LIMIT commits in the default branch. + # They are returned newest-to-oldest, but we need to present them oldest-to-newest + project.repository.commits(newrev, limit: PROCESS_COMMIT_LIMIT).reverse elsif creating_branch? # Use the pushed commits that aren't reachable by the default branch # as a heuristic. This may include more commits than are actually |