Commit 0c4059ef authored by Douwe Maan's avatar Douwe Maan

Merge branch 'patch-issue-#56683' into 'master'

Process up to 100 commit messages for references when pushing to a new default branch

See merge request gitlab-org/gitlab-ce!29511
parents 4eb63d82 352b43e0
...@@ -20,8 +20,7 @@ module Git ...@@ -20,8 +20,7 @@ module Git
strong_memoize(:commits) do strong_memoize(:commits) do
if creating_default_branch? if creating_default_branch?
# The most recent PROCESS_COMMIT_LIMIT commits in the default branch # The most recent PROCESS_COMMIT_LIMIT commits in the default branch
offset = [count_commits_in_branch - PROCESS_COMMIT_LIMIT, 0].max project.repository.commits(params[:newrev], limit: PROCESS_COMMIT_LIMIT)
project.repository.commits(params[:newrev], offset: offset, limit: PROCESS_COMMIT_LIMIT)
elsif creating_branch? elsif creating_branch?
# Use the pushed commits that aren't reachable by the default branch # Use the pushed commits that aren't reachable by the default branch
# as a heuristic. This may include more commits than are actually # as a heuristic. This may include more commits than are actually
...@@ -84,9 +83,6 @@ module Git ...@@ -84,9 +83,6 @@ module Git
# Schedules processing of commit messages # Schedules processing of commit messages
def enqueue_process_commit_messages def enqueue_process_commit_messages
# don't process commits for the initial push to the default branch
return if creating_default_branch?
limited_commits.each do |commit| limited_commits.each do |commit|
next unless commit.matches_cross_reference_regex? next unless commit.matches_cross_reference_regex?
......
---
title: Process up to 100 commit messages for references when pushing to a new default
branch
merge_request: 29511
author: Fabio Papa
type: fixed
...@@ -287,8 +287,8 @@ describe Git::BranchHooksService do ...@@ -287,8 +287,8 @@ describe Git::BranchHooksService do
context 'creating the default branch' do context 'creating the default branch' do
let(:oldrev) { Gitlab::Git::BLANK_SHA } let(:oldrev) { Gitlab::Git::BLANK_SHA }
it 'does not process commit messages' do it 'processes a limited number of commit messages' do
expect(ProcessCommitWorker).not_to receive(:perform_async) expect(ProcessCommitWorker).to receive(:perform_async).once
service.execute service.execute
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment