Commit 4ebc6239 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'create-branch-service-create-file' into 'master'

Fix CreateBranchService after Repository#commit_file was renamed to create_file

Closes #29687

See merge request !10081
parents 1e5888d1 163ba974
...@@ -25,12 +25,12 @@ class CreateBranchService < BaseService ...@@ -25,12 +25,12 @@ class CreateBranchService < BaseService
private private
def create_master_branch def create_master_branch
project.repository.commit_file( project.repository.create_file(
current_user, current_user,
'/README.md', '/README.md',
'', '',
message: 'Add README.md', message: 'Add README.md',
branch_name: 'master', branch_name: 'master'
update: false) )
end end
end end
require 'spec_helper'
describe CreateBranchService, services: true do
let(:user) { create(:user) }
let(:service) { described_class.new(project, user) }
describe '#execute' do
context 'when repository is empty' do
let(:project) { create(:project_empty_repo) }
it 'creates master branch' do
service.execute('my-feature', 'master')
expect(project.repository.branch_exists?('master')).to be_truthy
end
it 'creates my-feature branch' do
service.execute('my-feature', 'master')
expect(project.repository.branch_exists?('my-feature')).to be_truthy
end
end
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