Skip to content
Snippets Groups Projects
Commit 7a70b6d6 authored by Stan Hu's avatar Stan Hu
Browse files

Remove extraneous newlines in pre-receive hook

Found while investigating slow performance in gitlab-org/gitlab-ce#17225

We were adding a newline for every branch push because:

1. GitlabAccess calls changes.lines, which keeps the newline (e.g. ['00000000 12345678 refs/heads/master\n'])
2. GitlabNet calls changes.join("\n"), which adds another newline
parent 9bf99423
No related branches found
No related tags found
1 merge request!58Remove extraneous newlines in pre-receive hook
Pipeline #
v3.0.0
- Remove extraneous newlines in pre-receive hook
- Remove rm-tag command (Robert Schilling)
- Remove create-branch and rm-branch commands (Robert Schilling)
- Update PostReceive worker so it logs a unique JID in Sidekiq
Loading
Loading
Loading
Loading
@@ -16,7 +16,7 @@ class GitlabAccess
@repo_path = repo_path.strip
@actor = actor
@repo_name = extract_repo_name(@repo_path.dup, config.repos_path.to_s)
@changes = changes.lines
@changes = changes.split("\n")
end
 
def exec
Loading
Loading
Loading
Loading
@@ -11,7 +11,7 @@ describe GitlabAccess do
end
end
subject do
GitlabAccess.new(repo_path, 'key-123', 'wow').tap do |access|
GitlabAccess.new(repo_path, 'key-123', "first\nsecond\n").tap do |access|
access.stub(exec_cmd: :exec_called)
access.stub(api: api)
end
Loading
Loading
@@ -24,7 +24,7 @@ describe GitlabAccess do
describe :initialize do
it { subject.repo_name.should == repo_name }
it { subject.repo_path.should == repo_path }
it { subject.changes.should == ['wow'] }
it { subject.changes.should == ['first', 'second'] }
end
 
describe "#exec" do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment