diff options
author | Rémy Coutable <remy@rymai.me> | 2016-06-13 12:46:29 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-06-13 12:46:29 +0000 |
commit | dc38551b93abe5f1adb655aff68fc451dc3d8e73 (patch) | |
tree | 0cfb8150fe76afe92d591127367afb9cff455bf0 | |
parent | e8ebc1b6374464586269fcc8f5a025934eac8294 (diff) | |
parent | b9977525394ac714e31c1751690c7b993eb8d830 (diff) | |
download | gitlab-ce-dc38551b93abe5f1adb655aff68fc451dc3d8e73.tar.gz |
Merge branch '18377-cherry-pick-crashes-when-choosing-a-tag' into 'master'
Only show branches for revert / cherry-pick
## What does this MR do?
Stop showing tags in the revert and cherry-pick select options. You can't change a tag anyway.
## Are there points in the code the reviewer needs to double check?
Uncertain.
## Why was this MR needed?
Showing tags doesn't make any sense and will just throw an exception if the user tries to cherry-pick or revert onto a tag.
## What are the relevant issue numbers?
Fixes #18377.
## Screenshots (if relevant)
On the GitLab CE repo:
![image](/uploads/9c5a6f09300a7c46d0a794bef2956992/image.png)
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [ ] API support added
- [ ] Tests
- [x] Added for this feature/bug
- [ ] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !4596
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/helpers/branches_helper.rb | 4 | ||||
-rw-r--r-- | app/views/projects/commit/_change.html.haml | 2 | ||||
-rw-r--r-- | spec/features/projects/commits/cherry_pick_spec.rb | 1 |
4 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG index 549b8ea707d..23292cb3ddb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,7 @@ v 8.9.0 (unreleased) - Fix issue with arrow keys not working in search autocomplete dropdown - Make EmailsOnPushWorker use Sidekiq mailers queue - Fix wiki page events' webhook to point to the wiki repository + - Don't show tags for revert and cherry-pick operations - Fix issue todo not remove when leave project !4150 (Long Nguyen) - Allow customisable text on the 'nearly there' page after a user signs up - Bump recaptcha gem to 3.0.0 to remove deprecated stoken support diff --git a/app/helpers/branches_helper.rb b/app/helpers/branches_helper.rb index e39548e17e1..3ee3fc74f0c 100644 --- a/app/helpers/branches_helper.rb +++ b/app/helpers/branches_helper.rb @@ -14,4 +14,8 @@ module BranchesHelper ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(branch_name) end + + def project_branches + options_for_select(@project.repository.branch_names, @project.default_branch) + end end diff --git a/app/views/projects/commit/_change.html.haml b/app/views/projects/commit/_change.html.haml index 44ef1fdbbe3..d9b800a4ded 100644 --- a/app/views/projects/commit/_change.html.haml +++ b/app/views/projects/commit/_change.html.haml @@ -17,7 +17,7 @@ .form-group.branch = label_tag 'target_branch', target_label, class: 'control-label' .col-sm-10 - = select_tag "target_branch", grouped_options_refs, class: "select2 select2-sm js-target-branch" + = select_tag "target_branch", project_branches, class: "select2 select2-sm js-target-branch" - if can?(current_user, :push_code, @project) .js-create-merge-request-container .checkbox diff --git a/spec/features/projects/commits/cherry_pick_spec.rb b/spec/features/projects/commits/cherry_pick_spec.rb index 0559b02f321..f88c0616b52 100644 --- a/spec/features/projects/commits/cherry_pick_spec.rb +++ b/spec/features/projects/commits/cherry_pick_spec.rb @@ -16,6 +16,7 @@ describe 'Cherry-pick Commits' do it do visit namespace_project_commit_path(project.namespace, project, master_pickable_commit.id) find("a[href='#modal-cherry-pick-commit']").click + expect(page).not_to have_content('v1.0.0') # Only branches, not tags page.within('#modal-cherry-pick-commit') do uncheck 'create_merge_request' click_button 'Cherry-pick' |