From d4516cf5cd55b6f6f36451548eeaead0bde23a88 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 27 Apr 2015 07:42:32 +0000 Subject: [PATCH 1/7] Merge branch 'fix-gitorious-importer' into 'master' Get Gitorious importer to work again. Fixes #1504. See merge request !576 --- CHANGELOG | 1 + app/controllers/import/gitorious_controller.rb | 2 +- lib/gitlab/gitorious_import/client.rb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1aab904f11..97e2827989 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.11.0 (unreleased) + - Get Gitorious importer to work again. - Fix clone URL field and X11 Primary selection (Dmitry Medvinsky) - Ignore invalid lines in .gitmodules - diff --git a/app/controllers/import/gitorious_controller.rb b/app/controllers/import/gitorious_controller.rb index 6067a87ee0..c121d2de7c 100644 --- a/app/controllers/import/gitorious_controller.rb +++ b/app/controllers/import/gitorious_controller.rb @@ -6,7 +6,7 @@ class Import::GitoriousController < Import::BaseController def callback session[:gitorious_repos] = params[:repos] - redirect_to status_import_gitorious_url + redirect_to status_import_gitorious_path end def status diff --git a/lib/gitlab/gitorious_import/client.rb b/lib/gitlab/gitorious_import/client.rb index 8cdc3d4afa..1fa89dba44 100644 --- a/lib/gitlab/gitorious_import/client.rb +++ b/lib/gitlab/gitorious_import/client.rb @@ -14,7 +14,7 @@ module Gitlab end def repos - @repos ||= repo_names.map { |full_name| Repository.new(full_name) } + @repos ||= repo_names.map { |full_name| GitoriousImport::Repository.new(full_name) } end def repo(id) From 8ef84b3e5c957cec1cf0ea083c0920294daa42d4 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 28 Apr 2015 08:31:48 +0000 Subject: [PATCH 2/7] Merge branch 'admin-add-group-members' into 'master' Fix adding new group members from admin area Fix for #2222 Tests for this case already exists but it was green. It related to current way dealing with ajax selectbox. Improving tests might be a reason for another merge requests - everyone is welcome to participate. See merge request !1796 --- CHANGELOG | 15 +++++++++++++++ app/views/admin/groups/show.html.haml | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 97e2827989..2c4af5362d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,6 +13,21 @@ v 7.11.0 (unreleased) - v 7.10.0 (unreleased) + - Show Atom feed buttons everywhere where applicable. + - Add project activity atom feed. + - Don't crash when an MR from a fork has a cross-reference comment from the target project on of its commits. + - Include commit comments in MR from a forked project. + - Fix adding new group members from admin area + - Add default project and snippet visibility settings to the admin web UI. + - Fix bug where Slack service channel was not saved in admin template settings. (Stan Hu) + - Move snippets UI to fluid layout + - Improve UI for sidebar. Increase separation between navigation and content + - Improve new project command options (Ben Bodenmiller) + - Prevent sending empty messages to HipChat (Chulki Lee) + - Improve UI for mobile phones on dashboard and project pages + - Add room notification and message color option for HipChat + +v 7.10.0 - Ignore submodules that are defined in .gitmodules but are checked in as directories. - Allow projects to be imported from Google Code. - Remove access control for uploaded images to fix broken images in emails (Hannes Rosenögger) diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml index 14996dcd6a..427f38018b 100644 --- a/app/views/admin/groups/show.html.haml +++ b/app/views/admin/groups/show.html.haml @@ -60,7 +60,7 @@ = form_tag members_update_admin_group_path(@group), id: "new_project_member", class: "bulk_import", method: :put do %div - = users_select_tag(:user_ids, multiple: true, email_user: true) + = users_select_tag(:user_ids, multiple: true, email_user: true, scope: :all) %div.prepend-top-10 = select_tag :access_level, options_for_select(GroupMember.access_level_roles), class: "project-access-select select2" %hr From 7ef05ad0e8df747b2a5af1205951270ca10a08e2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 5 May 2015 15:22:01 +0000 Subject: [PATCH 3/7] Merge branch 'fix_ci_services' into 'master' Fix CI links on MR page Fixes gitlab-org/gitlab-ci#145 See merge request !609 --- CHANGELOG | 3 +++ app/models/project_services/gitlab_ci_service.rb | 4 ++-- spec/models/project_services/gitlab_ci_service_spec.rb | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2c4af5362d..94deedf952 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -27,6 +27,9 @@ v 7.10.0 (unreleased) - Improve UI for mobile phones on dashboard and project pages - Add room notification and message color option for HipChat +v 7.10.2 + - Fix CI links on MR page + v 7.10.0 - Ignore submodules that are defined in .gitmodules but are checked in as directories. - Allow projects to be imported from Google Code. diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb index 0f9838a575..f6f75cae8e 100644 --- a/app/models/project_services/gitlab_ci_service.rb +++ b/app/models/project_services/gitlab_ci_service.rb @@ -43,7 +43,7 @@ class GitlabCiService < CiService end def commit_status_path(sha, ref) - project_url + "/refs/#{ref}/commits/#{sha}/status.json?token=#{token}" + URI::encode(project_url + "/refs/#{ref}/commits/#{sha}/status.json?token=#{token}") end def get_ci_build(sha, ref) @@ -90,7 +90,7 @@ class GitlabCiService < CiService end def build_page(sha, ref) - project_url + "/refs/#{ref}/commits/#{sha}" + URI::encode(project_url + "/refs/#{ref}/commits/#{sha}") end def builds_path diff --git a/spec/models/project_services/gitlab_ci_service_spec.rb b/spec/models/project_services/gitlab_ci_service_spec.rb index 6a557d839c..d3bbd6174e 100644 --- a/spec/models/project_services/gitlab_ci_service_spec.rb +++ b/spec/models/project_services/gitlab_ci_service_spec.rb @@ -40,10 +40,12 @@ describe GitlabCiService do describe :commit_status_path do it { expect(@service.commit_status_path("2ab7834c", 'master')).to eq("http://ci.gitlab.org/projects/2/refs/master/commits/2ab7834c/status.json?token=verySecret")} + it { expect(@service.commit_status_path("issue#2", 'master')).to eq("http://ci.gitlab.org/projects/2/refs/master/commits/issue%232/status.json?token=verySecret")} end describe :build_page do it { expect(@service.build_page("2ab7834c", 'master')).to eq("http://ci.gitlab.org/projects/2/refs/master/commits/2ab7834c")} + it { expect(@service.build_page("issue#2", 'master')).to eq("http://ci.gitlab.org/projects/2/refs/master/commits/issue%232")} end end From 3976630c32a35d589b94fa563a4cc2773b84a204 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 4 May 2015 08:53:21 +0000 Subject: [PATCH 4/7] Merge branch 'fix-wiki-search' into 'master' Fix Error 500 when searching Wiki pages If a Wiki page turns up a hit in the search results, an error will occur: ``` Completed 500 Internal Server Error in 836ms NoMethodError - undefined method `slug' for "test.markdown":String: app/helpers/wiki_helper.rb:10:in `namespace_project_wiki_path' app/views/search/results/_wiki_blob.html.haml:4:in `_app_views_search_results__wiki_blob_html_haml___2752621660395393333_70299911622700' actionview (4.1.9) lib/action_view/template.rb:145:in `block in render' activesupport (4.1.9) lib/active_support/notifications.rb:161:in `instrument' actionview (4.1.9) lib/action_view/template.rb:339:in `instrument' actionview (4.1.9) lib/action_view/template.rb:143:in `render' ``` An unhandled String containing the name of the Wiki page would be provided to the URL path generator. This MR handles that case. Closes #1547 See merge request !592 --- CHANGELOG | 6 ++++++ app/helpers/wiki_helper.rb | 2 ++ features/search.feature | 6 ++++++ features/steps/project/wiki.rb | 5 +++++ features/steps/search.rb | 20 ++++++++++++++++++++ 5 files changed, 39 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 94deedf952..f290da5809 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,12 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.11.0 (unreleased) + - Make Reply-To config apply to change e-mail confirmation and other Devise notifications (Stan Hu) + - Add application setting to restrict user signups to e-mail domains (Stan Hu) + - Don't allow a merge request to be merged when its title starts with "WIP". + - Add a page title to every page. + - Allow primary email to be set to an email that you've already added. + - Fix Error 500 when searching Wiki pages (Stan Hu) - Get Gitorious importer to work again. - Fix clone URL field and X11 Primary selection (Dmitry Medvinsky) - Ignore invalid lines in .gitmodules diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb index a3bc64c010..f8a96516e6 100644 --- a/app/helpers/wiki_helper.rb +++ b/app/helpers/wiki_helper.rb @@ -6,6 +6,8 @@ module WikiHelper case wiki_page when Symbol wiki_page + when String + wiki_page else wiki_page.slug end diff --git a/features/search.feature b/features/search.feature index def21e0092..1608e82467 100644 --- a/features/search.feature +++ b/features/search.feature @@ -44,3 +44,9 @@ Feature: Search Then I should see "Foo" link in the search results And I should not see "Bar" link in the search results + Scenario: I should see Wiki blobs + And project has Wiki content + When I click project "Shop" link + And I search for "Wiki content" + And I click "Wiki" link + Then I should see "test_wiki" link in the search results diff --git a/features/steps/project/wiki.rb b/features/steps/project/wiki.rb index bb93e582a1..717132da45 100644 --- a/features/steps/project/wiki.rb +++ b/features/steps/project/wiki.rb @@ -159,6 +159,11 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps page.should have_content('History for') end + step 'I search for Wiki content' do + fill_in "Search in this project", with: "wiki_content" + click_button "Search" + end + def wiki @project_wiki = ProjectWiki.new(project, current_user) end diff --git a/features/steps/search.rb b/features/steps/search.rb index 6f0e038c4d..8197cd410a 100644 --- a/features/steps/search.rb +++ b/features/steps/search.rb @@ -18,6 +18,11 @@ class Spinach::Features::Search < Spinach::FeatureSteps click_button "Search" end + step 'I search for "Wiki content"' do + fill_in "dashboard_search", with: "content" + click_button "Search" + end + step 'I click "Issues" link' do within '.search-filter' do click_link 'Issues' @@ -36,6 +41,12 @@ class Spinach::Features::Search < Spinach::FeatureSteps end end + step 'I click "Wiki" link' do + within '.search-filter' do + click_link 'Wiki' + end + end + step 'I should see "Shop" project link' do page.should have_link "Shop" end @@ -66,4 +77,13 @@ class Spinach::Features::Search < Spinach::FeatureSteps step 'I should not see "Bar" link in the search results' do find(:css, '.search-results').should_not have_link 'Bar' end + + step 'I should see "test_wiki" link in the search results' do + find(:css, '.search-results').should have_link 'test_wiki.md' + end + + step 'project has Wiki content' do + @wiki = ::ProjectWiki.new(project, current_user) + @wiki.create_page("test_wiki", "Some Wiki content", :markdown, "first commit") + end end From 81634bc1f7d8abb1686ca0cf2318bc02f3c7d97c Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 30 Apr 2015 17:20:36 +0000 Subject: [PATCH 5/7] Merge branch 'fix-project-tags' into 'master' Fix DB error when trying to tag a repository Steps to reproduce: Go to a project settings, add tags, click on save changes Observed behavior: Error 500 ``` PG::Error: ERROR: column "taggings_count" does not exist LINE 1: UPDATE "tags" SET "taggings_count" = COALESCE("taggings_coun... ``` Ran `rake acts_as_taggable_on_engine:install:migrations`, removed the first migration that created the `tags` and `taggings` table, and added the rest. * Closes #1512 * Closes #1550 * Closes https://github.com/gitlabhq/gitlabhq/issues/6867 * Closes https://github.com/gitlabhq/gitlabhq/issues/9194 See merge request !577 --- CHANGELOG | 5 +++++ ...ique_indices.acts_as_taggable_on_engine.rb | 20 +++++++++++++++++++ ...ache_to_tags.acts_as_taggable_on_engine.rb | 15 ++++++++++++++ ...ggable_index.acts_as_taggable_on_engine.rb | 10 ++++++++++ ...or_tag_names.acts_as_taggable_on_engine.rb | 10 ++++++++++ db/schema.rb | 7 +++++-- features/project/project.feature | 7 +++++++ features/steps/project/project.rb | 8 ++++++++ 8 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20150425164648_add_missing_unique_indices.acts_as_taggable_on_engine.rb create mode 100644 db/migrate/20150425164649_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb create mode 100644 db/migrate/20150425164650_add_missing_taggable_index.acts_as_taggable_on_engine.rb create mode 100644 db/migrate/20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb diff --git a/CHANGELOG b/CHANGELOG index f290da5809..e25f471692 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -11,6 +11,11 @@ v 7.11.0 (unreleased) - Fix clone URL field and X11 Primary selection (Dmitry Medvinsky) - Ignore invalid lines in .gitmodules - + - Fix broken file browsing with relative submodule in personal projects (Stan Hu) + - Fix DB error when trying to tag a repository (Stan Hu) + - Add "Reply quoting selected text" shortcut key (`r`) + - Fix bug causing `@whatever` inside an issue's first code block to be picked up as a user mention. + - Fix bug causing `@whatever` inside an inline code snippet (backtick-style) to be picked up as a user mention. - - - diff --git a/db/migrate/20150425164648_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20150425164648_add_missing_unique_indices.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000000..4ca676f6c7 --- /dev/null +++ b/db/migrate/20150425164648_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -0,0 +1,20 @@ +# This migration comes from acts_as_taggable_on_engine (originally 2) +class AddMissingUniqueIndices < ActiveRecord::Migration + def self.up + add_index :tags, :name, unique: true + + remove_index :taggings, :tag_id + remove_index :taggings, [:taggable_id, :taggable_type, :context] + add_index :taggings, + [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], + unique: true, name: 'taggings_idx' + end + + def self.down + remove_index :tags, :name + + remove_index :taggings, name: 'taggings_idx' + add_index :taggings, :tag_id + add_index :taggings, [:taggable_id, :taggable_type, :context] + end +end diff --git a/db/migrate/20150425164649_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20150425164649_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000000..8edb508078 --- /dev/null +++ b/db/migrate/20150425164649_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -0,0 +1,15 @@ +# This migration comes from acts_as_taggable_on_engine (originally 3) +class AddTaggingsCounterCacheToTags < ActiveRecord::Migration + def self.up + add_column :tags, :taggings_count, :integer, default: 0 + + ActsAsTaggableOn::Tag.reset_column_information + ActsAsTaggableOn::Tag.find_each do |tag| + ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings) + end + end + + def self.down + remove_column :tags, :taggings_count + end +end diff --git a/db/migrate/20150425164650_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20150425164650_add_missing_taggable_index.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000000..71f2d7f433 --- /dev/null +++ b/db/migrate/20150425164650_add_missing_taggable_index.acts_as_taggable_on_engine.rb @@ -0,0 +1,10 @@ +# This migration comes from acts_as_taggable_on_engine (originally 4) +class AddMissingTaggableIndex < ActiveRecord::Migration + def self.up + add_index :taggings, [:taggable_id, :taggable_type, :context] + end + + def self.down + remove_index :taggings, [:taggable_id, :taggable_type, :context] + end +end diff --git a/db/migrate/20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000000..bfb06bc7cd --- /dev/null +++ b/db/migrate/20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb @@ -0,0 +1,10 @@ +# This migration comes from acts_as_taggable_on_engine (originally 5) +# This migration is added to circumvent issue #623 and have special characters +# work properly +class ChangeCollationForTagNames < ActiveRecord::Migration + def up + if ActsAsTaggableOn::Utils.using_mysql? + execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 189bd53662..aa48169853 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -431,13 +431,16 @@ ActiveRecord::Schema.define(version: 20150429002313) do t.datetime "created_at" end - add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id", using: :btree + add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree create_table "tags", force: true do |t| - t.string "name" + t.string "name" + t.integer "taggings_count", default: 0 end + add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree + create_table "users", force: true do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false diff --git a/features/project/project.feature b/features/project/project.feature index 3e1fd54bee..ae28312a69 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -55,3 +55,10 @@ Feature: Project Then I should see project "Forum" README And I visit project "Shop" page Then I should see project "Shop" README + + Scenario: I tag a project + When I visit edit project "Shop" page + Then I should see project settings + And I add project tags + And I save project + Then I should see project tags diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index d39c8e7d2d..f14396bcff 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -94,4 +94,12 @@ class Spinach::Features::Project < Spinach::FeatureSteps page.should have_link 'README.md' page.should have_content 'testme' end + + step 'I add project tags' do + fill_in 'Tags', with: 'tag1, tag2' + end + + step 'I should see project tags' do + expect(find_field('Tags').value).to eq 'tag1, tag2' + end end From fe38be8be459eaf987e734b16074e22f3a88b5b8 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 4 May 2015 06:58:56 +0000 Subject: [PATCH 6/7] Merge branch 'fix-escaped-branches-in-compare' into 'master' Unescape branch names in compare commit The upgrade in GitLab v7.9 to Rails v4.1.9 caused all branch names in the compare commit mode to be escaped (e.g. `/` to `%2F`). The compare mode would not always work when comparing against branch names with a forward slash. Opted to unescape the branch name rather than use a wildcard segment to prevent escaping slashes because it seems like a more sensible URL. The slashes in this case aren't really represented by a tree structure (e.g. /compare/one/two/branch..another/branch/here). * Closes #1399 * Closes https://github.com/gitlabhq/gitlabhq/issues/9105 See merge request !582 --- CHANGELOG | 4 ++++ .../projects/compare_controller.rb | 6 +++-- .../projects/compare_controller_spec.rb | 22 +++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 spec/controllers/projects/compare_controller_spec.rb diff --git a/CHANGELOG b/CHANGELOG index e25f471692..7165513b50 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -30,6 +30,10 @@ v 7.10.0 (unreleased) - Include commit comments in MR from a forked project. - Fix adding new group members from admin area - Add default project and snippet visibility settings to the admin web UI. + - Show incompatible projects in Google Code import status (Stan Hu) + - Fix bug where commit data would not appear in some subdirectories (Stan Hu) + - Unescape branch names in compare commit (Stan Hu) + - - Fix bug where Slack service channel was not saved in admin template settings. (Stan Hu) - Move snippets UI to fluid layout - Improve UI for sidebar. Increase separation between navigation and content diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index 146808fa56..e1a8a5b6fa 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -1,3 +1,5 @@ +require 'addressable/uri' + class Projects::CompareController < Projects::ApplicationController # Authorize before_filter :require_non_empty_project @@ -7,8 +9,8 @@ class Projects::CompareController < Projects::ApplicationController end def show - base_ref = params[:from] - head_ref = params[:to] + base_ref = Addressable::URI.unescape(params[:from]) + head_ref = Addressable::URI.unescape(params[:to]) compare_result = CompareService.new.execute( current_user, diff --git a/spec/controllers/projects/compare_controller_spec.rb b/spec/controllers/projects/compare_controller_spec.rb new file mode 100644 index 0000000000..23e1566b8f --- /dev/null +++ b/spec/controllers/projects/compare_controller_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe Projects::CompareController do + let(:project) { create(:project) } + let(:user) { create(:user) } + let(:ref_from) { "improve%2Fawesome" } + let(:ref_to) { "feature" } + + before do + sign_in(user) + project.team << [user, :master] + end + + it 'compare should show some diffs' do + get(:show, namespace_id: project.namespace.to_param, + project_id: project.to_param, from: ref_from, to: ref_to) + + expect(response).to be_success + expect(assigns(:diffs).length).to be >= 1 + expect(assigns(:commits).length).to be >= 1 + end +end From c99f4e9314dea373b1507fbad7250e9cb8588363 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Tue, 28 Apr 2015 15:46:36 +0000 Subject: [PATCH 7/7] Merge branch 'fix-commit-data-url-generation' into 'master' Fix bug where commit data would not appear in some subdirectories Fix issue where commit data would not show up in some subdirectories due to escaped slashes. For example: https://gitlab.common-lisp.net/ecl/ecl/tree/develop/src/gc (now patched with fix) The upgrade from Rails v4.1.2 to v4.1.9 (76aad9b76ed) caused slashes in a tree to be escaped automatically. Using a wildcard glob in the route prevents this behavior. * Closes #1478, #1459 * Closes https://github.com/gitlabhq/gitlabhq/issues/9037 See merge request !581 --- CHANGELOG | 2 ++ config/routes.rb | 2 +- spec/lib/extracts_path_spec.rb | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 7165513b50..2eec1d6a50 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -34,6 +34,8 @@ v 7.10.0 (unreleased) - Fix bug where commit data would not appear in some subdirectories (Stan Hu) - Unescape branch names in compare commit (Stan Hu) - + - + - Fix bug where commit data would not appear in some subdirectories (Stan Hu) - Fix bug where Slack service channel was not saved in admin template settings. (Stan Hu) - Move snippets UI to fluid layout - Improve UI for sidebar. Increase separation between navigation and content diff --git a/config/routes.rb b/config/routes.rb index 744a99fede..e08ef6fc04 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -433,7 +433,7 @@ Gitlab::Application.routes.draw do member do # tree viewer logs get 'logs_tree', constraints: { id: Gitlab::Regex.git_reference_regex } - get 'logs_tree/:path' => 'refs#logs_tree', as: :logs_file, constraints: { + get 'logs_tree/*path' => 'refs#logs_tree', as: :logs_file, constraints: { id: Gitlab::Regex.git_reference_regex, path: /.*/ } diff --git a/spec/lib/extracts_path_spec.rb b/spec/lib/extracts_path_spec.rb index ac602eac15..05bcebaa3a 100644 --- a/spec/lib/extracts_path_spec.rb +++ b/spec/lib/extracts_path_spec.rb @@ -2,6 +2,8 @@ require 'spec_helper' describe ExtractsPath do include ExtractsPath + include RepoHelpers + include Rails.application.routes.url_helpers let(:project) { double('project') } @@ -11,6 +13,20 @@ describe ExtractsPath do project.stub(path_with_namespace: 'gitlab/gitlab-ci') end + describe '#assign_ref' do + let(:ref) { sample_commit[:id] } + let(:params) { {path: sample_commit[:line_code_path], ref: ref} } + + before do + @project = create(:project) + end + + it "log tree path should have no escape sequences" do + assign_ref_vars + expect(@logs_path).to eq("/#{@project.path_with_namespace}/refs/#{ref}/logs_tree/files/ruby/popen.rb") + end + end + describe '#extract_ref' do it "returns an empty pair when no @project is set" do @project = nil