Commit e8f92aed authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch...

Merge branch '221013-add-instance-setting-for-default-branch-name-for-new-repositories' into 'master'

Customizable default branch name setting

See merge request gitlab-org/gitlab!35269
parents 249020bd b8863bb3
= form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-default-branch-name'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting)
- fallback_branch_name = '<code>master</code>'
%fieldset
.form-group
= f.label :default_branch_name, _('Default initial branch name'), class: 'label-light'
= f.text_field :default_branch_name, placeholder: 'master', class: 'form-control'
%span.form-text.text-muted
= (_("Changes affect new repositories only. If not specified, Git's default name %{branch_name_default} will be used.") % { branch_name_default: fallback_branch_name } ).html_safe
= f.submit _('Save changes'), class: 'gl-button btn-success'
......@@ -2,6 +2,18 @@
- page_title _("Repository")
- @content_class = "limit-container-width" unless fluid_layout
- if Feature.enabled?(:global_default_branch_name)
%section.settings.as-default-branch-name.no-animate#js-default-branch-name{ class: ('expanded' if expanded_by_default?) }
.settings-header
%h4
= _('Default initial branch name')
%button.gl-button.js-settings-toggle{ type: 'button' }
= expanded_by_default? ? _('Collapse') : _('Expand')
%p
= _('Set the default name of the initial branch when creating new repositories through the user interface.')
.settings-content
= render 'initial_branch_name'
%section.settings.as-mirror.no-animate#js-mirror-settings{ class: ('expanded' if expanded_by_default?) }
.settings-header
%h4
......
......@@ -4266,6 +4266,9 @@ msgstr ""
msgid "Changes"
msgstr ""
msgid "Changes affect new repositories only. If not specified, Git's default name %{branch_name_default} will be used."
msgstr ""
msgid "Changes are shown as if the <b>source</b> revision was being merged into the <b>target</b> revision."
msgstr ""
......@@ -7423,6 +7426,9 @@ msgstr ""
msgid "Default first day of the week in calendars and date pickers."
msgstr ""
msgid "Default initial branch name"
msgstr ""
msgid "Default issue template"
msgstr ""
......@@ -21110,6 +21116,9 @@ msgstr ""
msgid "Set the default expiration time for each job's artifacts. 0 for unlimited. The default unit is in seconds, but you can define an alternative. For example: <code>4 mins 2 sec</code>, <code>2h42min</code>."
msgstr ""
msgid "Set the default name of the initial branch when creating new repositories through the user interface."
msgstr ""
msgid "Set the due date to %{due_date}."
msgstr ""
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'admin/application_settings/repository.html.haml' do
let(:app_settings) { build(:application_setting) }
let(:user) { create(:admin) }
before do
assign(:application_setting, app_settings)
allow(view).to receive(:current_user).and_return(user)
end
describe 'default initial branch name' do
context 'when the feature flag is disabled' do
before do
stub_feature_flags(global_default_branch_name: false)
end
it 'does not show the setting section' do
render
expect(rendered).not_to have_css("#js-default-branch-name")
end
end
context 'when the feature flag is enabled' do
before do
stub_feature_flags(global_default_branch_name: true)
end
it 'has the setting section' do
render
expect(rendered).to have_css("#js-default-branch-name")
end
it 'renders the correct setting section content' do
render
expect(rendered).to have_content("Default initial branch name")
expect(rendered).to have_content("Set the default name of the initial branch when creating new repositories through the user interface.")
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