Commit 224e104d authored by Hannes Rosenögger's avatar Hannes Rosenögger

fix mass SQL statements on initial push

This commit disables process_commit_messages()
for the initial push to the default branch.
This fixes the mass SQL statements (~500000) that were executed during
the initial push of the linux kernel for example.
parent 6b214a5d
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 7.9.0 (unreleased) v 7.9.0 (unreleased)
- Fix mass SQL statements on initial push (Hannes Rosenögger)
- Add tag push notifications and normalize HipChat and Slack messages to be consistent (Stan Hu) - Add tag push notifications and normalize HipChat and Slack messages to be consistent (Stan Hu)
- Add comment notification events to HipChat and Slack services (Stan Hu) - Add comment notification events to HipChat and Slack services (Stan Hu)
- Add issue and merge request events to HipChat and Slack services (Stan Hu) - Add issue and merge request events to HipChat and Slack services (Stan Hu)
......
...@@ -42,8 +42,10 @@ class GitPushService ...@@ -42,8 +42,10 @@ class GitPushService
# as a heuristic. This may include more commits than are actually pushed, but # as a heuristic. This may include more commits than are actually pushed, but
# that shouldn't matter because we check for existing cross-references later. # that shouldn't matter because we check for existing cross-references later.
@push_commits = project.repository.commits_between(project.default_branch, newrev) @push_commits = project.repository.commits_between(project.default_branch, newrev)
# don't process commits for the initial push to the default branch
process_commit_messages(ref)
end end
process_commit_messages(ref)
elsif push_to_existing_branch?(ref, oldrev) elsif push_to_existing_branch?(ref, oldrev)
# Collect data for this git push # Collect data for this git push
@push_commits = project.repository.commits_between(oldrev, newrev) @push_commits = project.repository.commits_between(oldrev, newrev)
......
...@@ -197,15 +197,6 @@ describe GitPushService do ...@@ -197,15 +197,6 @@ describe GitPushService do
service.execute(project, user, @blankrev, @newrev, 'refs/heads/other') service.execute(project, user, @blankrev, @newrev, 'refs/heads/other')
end end
it "finds references in the first push to a default branch" do
allow(project.repository).to receive(:commits_between).with(@blankrev, @newrev).and_return([])
allow(project.repository).to receive(:commits).with(@newrev).and_return([commit])
expect(Note).to receive(:create_cross_reference_note).with(issue, commit, commit_author, project)
service.execute(project, user, @blankrev, @newrev, 'refs/heads/master')
end
end end
describe "closing issues from pushed commits" do describe "closing issues from pushed commits" do
......
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