Commit 325ed6ab authored by Douwe Maan's avatar Douwe Maan

Merge branch 'hide-squash-one-commit' into 'master'

Hide squash checkbox when there is a single commit

Closes #1697

See merge request !1213
parents 59a58038 12c6b641
......@@ -38,9 +38,10 @@
= label_tag :should_remove_source_branch, class: "merge-param-checkbox" do
= check_box_tag :should_remove_source_branch
Remove source branch
= hidden_field_tag :squash, '0', id: nil
- if @merge_request.commits_count > 1
.accept-control.checkbox
= label_tag :squash, class: 'merge-param-checkbox' do
= hidden_field_tag :squash, '0', id: nil
= check_box_tag :squash, '1', @merge_request.squash
Squash commits
= link_to icon('question-circle'), help_page_path('user/project/merge_requests/squash_and_merge'), title: 'About this feature', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'}
......
......@@ -46,6 +46,18 @@ feature 'Squashing merge requests', js: true, feature: true do
login_as user
end
context 'when the MR has only one commit' do
before do
merge_request = create(:merge_request, source_project: project, target_project: project, source_branch: 'master', target_branch: 'branch-merged')
visit namespace_project_merge_request_path(project.namespace, project, merge_request)
end
it 'does not show the squash checkbox' do
expect(page).not_to have_field('squash')
end
end
context 'when squash is enabled on merge request creation' do
before do
visit new_namespace_project_merge_request_path(project.namespace, project, merge_request: { target_branch: 'master', source_branch: source_branch })
......
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