Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-05-06 09:49:30 +0300
committerStan Hu <stanhu@gmail.com>2015-05-06 09:49:30 +0300
commit03138a3c72d9ccdfda6398564c6183de70c68df5 (patch)
treee0730100c63527b5a00b2afc1a6b9ce964ea8014 /spec/services/git_push_service_spec.rb
parent91846578711c7f32fd5e26437b5c14c66f8156fb (diff)
Make the first branch pushed to an empty repository the default HEAD.
In an empty repository, pushing a new branch not called "master" would leave HEAD in an unknown state, causing ambiguity if another branch were pushed. This could in turn cause a new protected branch to be created and cause the default branch to change. * Closes #1561 * Closes #1576 * Closes https://github.com/gitlabhq/gitlabhq/issues/8883
Diffstat (limited to 'spec/services/git_push_service_spec.rb')
-rw-r--r--spec/services/git_push_service_spec.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb
index af37e8319a4..e7558f28768 100644
--- a/spec/services/git_push_service_spec.rb
+++ b/spec/services/git_push_service_spec.rb
@@ -234,5 +234,18 @@ describe GitPushService do
expect(Issue.find(issue.id)).to be_opened
end
end
-end
+ describe "empty project" do
+ let(:project) { create(:project_empty_repo) }
+ let(:new_ref) { 'refs/heads/feature'}
+
+ before do
+ allow(project).to receive(:default_branch).and_return('feature')
+ expect(project).to receive(:change_head) { 'feature'}
+ end
+
+ it 'push to first branch updates HEAD' do
+ service.execute(project, user, @blankrev, @newrev, new_ref)
+ end
+ end
+end