Commit b47015ad authored by Paul Slaughter's avatar Paul Slaughter

Move project default branch settings under 'Repository'

- Updates specs accordingly
- Updates docs accordingly
- Brews a fresh pot
parent afb49b04
- expanded = Rails.env.test?
%section.settings.no-animate#default-branch-settings{ class: ('expanded' if expanded) }
.settings-header
%h4= _('Default Branch')
%button.btn.js-settings-toggle
= expanded ? _('Collapse') : _('Expand')
%p
= _('Select the branch you want to set as the default for this project. All merge requests and commits will automatically be made against this branch unless you specify a different one.')
.settings-content
- if @project.empty_repo?
.text-secondary
= _('A default branch cannot be chosen for an empty project.')
- else
= form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, anchor: 'default-branch-settings' }, authenticity_token: true do |f|
%fieldset
.form-group
= f.label :default_branch, "Default Branch", class: 'label-bold'
= f.select(:default_branch, @project.repository.branch_names, {}, {class: 'select2 select-wide'})
= f.submit 'Save changes', class: "btn btn-success"
...@@ -36,11 +36,6 @@ ...@@ -36,11 +36,6 @@
= render_if_exists 'projects/classification_policy_settings', f: f = render_if_exists 'projects/classification_policy_settings', f: f
- unless @project.empty_repo?
.form-group
= f.label :default_branch, "Default Branch", class: 'label-bold'
= f.select(:default_branch, @project.repository.branch_names, {}, {class: 'select2 select-wide'})
= render_if_exists 'shared/repository_size_limit_setting', form: f, type: :project = render_if_exists 'shared/repository_size_limit_setting', form: f, type: :project
.form-group .form-group
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
- page_title _("Repository") - page_title _("Repository")
- @content_class = "limit-container-width" unless fluid_layout - @content_class = "limit-container-width" unless fluid_layout
= render "projects/default_branch/show"
= render "projects/mirrors/show" = render "projects/mirrors/show"
-# Protected branches & tags use a lot of nested partials. -# Protected branches & tags use a lot of nested partials.
......
---
title: Move project settings for default branch under "Repository"
merge_request: 21380
author:
type: changed
...@@ -16,7 +16,7 @@ See also: ...@@ -16,7 +16,7 @@ See also:
When you create a new [project](../../index.md), GitLab sets `master` as the default When you create a new [project](../../index.md), GitLab sets `master` as the default
branch for your project. You can choose another branch to be your project's branch for your project. You can choose another branch to be your project's
default under your project's **Settings > General**. default under your project's **Settings > Repository**.
The default branch is the branch affected by the The default branch is the branch affected by the
[issue closing pattern](../../issues/automatic_issue_closing.md), [issue closing pattern](../../issues/automatic_issue_closing.md),
......
...@@ -250,6 +250,9 @@ msgstr "" ...@@ -250,6 +250,9 @@ msgstr ""
msgid "A collection of graphs regarding Continuous Integration" msgid "A collection of graphs regarding Continuous Integration"
msgstr "" msgstr ""
msgid "A default branch cannot be chosen for an empty project."
msgstr ""
msgid "A new branch will be created in your fork and a new merge request will be started." msgid "A new branch will be created in your fork and a new merge request will be started."
msgstr "" msgstr ""
...@@ -2086,6 +2089,9 @@ msgstr "" ...@@ -2086,6 +2089,9 @@ msgstr ""
msgid "Decline and sign out" msgid "Decline and sign out"
msgstr "" msgstr ""
msgid "Default Branch"
msgstr ""
msgid "Default: Directly import the Google Code email address or username" msgid "Default: Directly import the Google Code email address or username"
msgstr "" msgstr ""
...@@ -5062,6 +5068,9 @@ msgstr "" ...@@ -5062,6 +5068,9 @@ msgstr ""
msgid "Select target branch" msgid "Select target branch"
msgstr "" msgstr ""
msgid "Select the branch you want to set as the default for this project. All merge requests and commits will automatically be made against this branch unless you specify a different one."
msgstr ""
msgid "Selecting a GitLab user will add a link to the GitLab user in the descriptions of issues and comments (e.g. \"By <a href=\"#\">@johnsmith</a>\"). It will also associate and/or assign these issues and comments with the selected user." msgid "Selecting a GitLab user will add a link to the GitLab user in the descriptions of issues and comments (e.g. \"By <a href=\"#\">@johnsmith</a>\"). It will also associate and/or assign these issues and comments with the selected user."
msgstr "" msgstr ""
......
require 'spec_helper' require 'spec_helper'
describe 'Projects > Settings > User changes default branch' do describe 'Projects > Settings > User changes default branch' do
include Select2Helper
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :repository, namespace: user.namespace) }
before do before do
sign_in(user) sign_in(user)
visit edit_project_path(project)
visit project_settings_repository_path(project)
end end
it 'allows to change the default branch' do context 'with normal project' do
select 'fix', from: 'project_default_branch' let(:project) { create(:project, :repository, namespace: user.namespace) }
page.within '.general-settings' do
it 'allows to change the default branch', :js do
select2('fix', from: '#project_default_branch')
page.within '#default-branch-settings' do
click_button 'Save changes' click_button 'Save changes'
end end
expect(find(:css, 'select#project_default_branch').value).to eq 'fix' expect(find('#project_default_branch', visible: false).value).to eq 'fix'
end
end
context 'with empty project' do
let(:project) { create(:project_empty_repo, namespace: user.namespace) }
it 'does not show default branch selector' do
expect(page).not_to have_selector('#project_default_branch')
end
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