diff --git a/CHANGELOG b/CHANGELOG index 517efae9f3148ea668ba358bf3ae93199a48c6a1..c8b2dd2ba777abbaa29c07edaba75ec3dcc1169f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,8 +1,12 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.10.0 (unreleased) + - Fix "Import projects from" button to show the correct instructions (Stan Hu) + - Fix dots in Wiki slugs causing errors (Stan Hu) + - Fix OAuth2 issue importing a new project from GitHub and GitLab (Stan Hu) - Update poltergeist to version 1.6.0 to support PhantomJS 2.0 (Zeger-Jan van de Weg) - Fix cross references when usernames, milestones, or project names contain underscores (Stan Hu) + - Disable reference creation for comments surrounded by code/preformatted blocks (Stan Hu) - enable line wrapping per default and remove the checkbox to toggle it (Hannes Rosenögger) - extend the commit calendar to show the actual commits made on a date (Hannes Rosenögger) - Fix a link in the patch update guide diff --git a/app/assets/images/authbuttons/gitlab_64.png_old b/app/assets/images/authbuttons/gitlab_64.png_old deleted file mode 100644 index 8390c81a08b310df07fe53a487368f6716745be7..0000000000000000000000000000000000000000 Binary files a/app/assets/images/authbuttons/gitlab_64.png_old and /dev/null differ diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb index 55438bee245ee9648c2e97596c38ab2fb0158044..772c868d9cd0088307f7bab85d8166878a528a1c 100644 --- a/app/models/project_wiki.rb +++ b/app/models/project_wiki.rb @@ -104,7 +104,7 @@ class ProjectWiki def page_title_and_dir(title) title_array = title.split("/") title = title_array.pop - [title.gsub(/\.[^.]*$/, ""), title_array.join("/")] + [title, title_array.join("/")] end def search_files(query) diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 32981a0e664be3a917c8ae7eecdb7b546e673723..e9413c34baed37f1e8008f5c7c8f14f8f8f1c5d7 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -179,7 +179,8 @@ class WikiPage if valid? && project_wiki.send(method, *args) page_details = if method == :update_page - @page.path + # Use url_path instead of path to omit format extension + @page.url_path else title end diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index 173a3080b3159972479ba3f9b13b46f7b3071e07..9687c8ad87c1ea9cc393e5ec17f463490d8fc0c9 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -74,9 +74,9 @@ = f.text_field :import_url, class: 'form-control', placeholder: 'https://username:password@gitlab.company.com/group/project.git' .alert.alert-info.prepend-top-10 %ul - %li + %li The repository must be accessible over HTTP(S). If it is not publicly accessible, you can add authentication information to the URL: https://username:password@gitlab.company.com/group/project.git. - %li + %li The import will time out after 4 minutes. For big repositories, use a clone/push combination. %li To migrate an SVN repository, check out #{link_to "this document", "http://doc.gitlab.com/ce/workflow/migrating_from_svn.html"}. @@ -112,6 +112,6 @@ $ -> $('.how_to_import_link').bind 'click', (e) -> e.preventDefault() - import_modal = $(this).parent().find(".modal").show() + import_modal = $(this).next(".modal").show() $('.modal-header .close').bind 'click', -> $(".modal").hide() diff --git a/doc/update/upgrader.md b/doc/update/upgrader.md index d8476fb345759fd68cb3e1da1812a8ea8196d5d5..f62a53d3340c22a670b07e37b55fae2489190d64 100644 --- a/doc/update/upgrader.md +++ b/doc/update/upgrader.md @@ -24,7 +24,7 @@ If you have local changes to your GitLab repository the script will stash them a ## 2. Run GitLab upgrade tool -Note: GitLab 7.9 adds nodejs as a dependency. GitLab 7.6 adds `libkrb5-dev` as a dependency (installed by default on Ubuntu and OSX). GitLab 7.2 adds `pkg-config` and `cmake` as dependency. Please check the dependencies in the [installation guide.](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md#1-packages-dependencies) +Note: GitLab 7.9 adds `nodejs` as a dependency. GitLab 7.6 adds `libkrb5-dev` as a dependency (installed by default on Ubuntu and OSX). GitLab 7.2 adds `pkg-config` and `cmake` as dependency. Please check the dependencies in the [installation guide.](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md#1-packages-dependencies) # Starting with GitLab version 7.0 upgrader script has been moved to bin directory cd /home/git/gitlab diff --git a/features/dashboard/new_project.feature b/features/dashboard/new_project.feature new file mode 100644 index 0000000000000000000000000000000000000000..431dc4ccfcb258c50a042274bb53d40832049b3b --- /dev/null +++ b/features/dashboard/new_project.feature @@ -0,0 +1,13 @@ +@dashboard +Feature: New Project +Background: + Given I sign in as a user + And I own project "Shop" + And I visit dashboard page + + @javascript + Scenario: I should see New projects page + Given I click "New project" link + Then I see "New project" page + When I click on "Import project from GitHub" + Then I see instructions on how to import from GitHub diff --git a/features/steps/dashboard/new_project.rb b/features/steps/dashboard/new_project.rb new file mode 100644 index 0000000000000000000000000000000000000000..5e588ceb780c7f4196ad2702a0adbf6b81370662 --- /dev/null +++ b/features/steps/dashboard/new_project.rb @@ -0,0 +1,27 @@ +class Spinach::Features::NewProject < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + step 'I click "New project" link' do + click_link "New project" + end + + step 'I see "New project" page' do + page.should have_content("Project path") + end + + step 'I click on "Import project from GitHub"' do + first('.how_to_import_link').click + end + + step 'I see instructions on how to import from GitHub' do + github_modal = first('.modal-body') + github_modal.should be_visible + github_modal.should have_content "To enable importing projects from GitHub" + + all('.modal-body').each do |element| + element.should_not be_visible unless element == github_modal + end + end +end diff --git a/lib/gitlab/bitbucket_import/client.rb b/lib/gitlab/bitbucket_import/client.rb index 1e4906c9e31785d9929cad0453b3a312e07d8601..5b1952b9675f126671b0d85db88e149e13b52f54 100644 --- a/lib/gitlab/bitbucket_import/client.rb +++ b/lib/gitlab/bitbucket_import/client.rb @@ -62,7 +62,7 @@ module Gitlab end def find_deploy_key(project_identifier, key) - JSON.parse(api.get("/api/1.0/repositories/#{project_identifier}/deploy-keys").body).find do |deploy_key| + JSON.parse(api.get("/api/1.0/repositories/#{project_identifier}/deploy-keys").body).find do |deploy_key| deploy_key["key"].chomp == key.chomp end end @@ -92,7 +92,7 @@ module Gitlab end def bitbucket_options - OmniAuth::Strategies::Bitbucket.default_options[:client_options].dup + OmniAuth::Strategies::Bitbucket.default_options[:client_options].symbolize_keys end end end diff --git a/lib/gitlab/github_import/client.rb b/lib/gitlab/github_import/client.rb index 7fe076b333b6c109bdb46af8c4bb082629f70fc4..270cbcd9ccd92b9ec35da9d90ec688b81f05b983 100644 --- a/lib/gitlab/github_import/client.rb +++ b/lib/gitlab/github_import/client.rb @@ -46,7 +46,7 @@ module Gitlab end def github_options - OmniAuth::Strategies::GitHub.default_options[:client_options].dup + OmniAuth::Strategies::GitHub.default_options[:client_options].symbolize_keys end end end diff --git a/lib/gitlab/gitlab_import/client.rb b/lib/gitlab/gitlab_import/client.rb index 2236439c6cef353e2fd2b83a5fe6d9b028a3d6ff..f48ede9d06795fb87f12eb128b2c5af783ec60e3 100644 --- a/lib/gitlab/gitlab_import/client.rb +++ b/lib/gitlab/gitlab_import/client.rb @@ -71,7 +71,7 @@ module Gitlab end def gitlab_options - OmniAuth::Strategies::GitLab.default_options[:client_options].dup + OmniAuth::Strategies::GitLab.default_options[:client_options].symbolize_keys end end end diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb index 5b9772de168fefb8dd0d3699d36635da678fb739..1058d4c43d9b9427da6581000992ff0eab815469 100644 --- a/lib/gitlab/reference_extractor.rb +++ b/lib/gitlab/reference_extractor.rb @@ -11,7 +11,13 @@ module Gitlab end def analyze(string, project) - parse_references(string.dup, project) + text = string.dup + + # Remove preformatted/code blocks so that references are not included + text.gsub!(%r{
.*?
|.*?}m) { |match| '' } + text.gsub!(%r{^```.*?^```}m) { |match| '' } + + parse_references(text, project) end # Given a valid project, resolve the extracted identifiers of the requested type to diff --git a/spec/lib/gitlab/bitbucket_import/client_spec.rb b/spec/lib/gitlab/bitbucket_import/client_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..dd450e9967b338f0b0ffb2929fb1afd1749272c2 --- /dev/null +++ b/spec/lib/gitlab/bitbucket_import/client_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe Gitlab::BitbucketImport::Client do + let(:token) { '123456' } + let(:secret) { 'secret' } + let(:client) { Gitlab::BitbucketImport::Client.new(token, secret) } + + before do + Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "bitbucket") + end + + it 'all OAuth client options are symbols' do + client.consumer.options.keys.each do |key| + expect(key).to be_kind_of(Symbol) + end + end +end diff --git a/spec/lib/gitlab/github_import/client_spec.rb b/spec/lib/gitlab/github_import/client_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..26618120316ace4d5aef3ddf6eab3f5b7d546a21 --- /dev/null +++ b/spec/lib/gitlab/github_import/client_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe Gitlab::GithubImport::Client do + let(:token) { '123456' } + let(:client) { Gitlab::GithubImport::Client.new(token) } + + before do + Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "github") + end + + it 'all OAuth2 client options are symbols' do + client.client.options.keys.each do |key| + expect(key).to be_kind_of(Symbol) + end + end +end diff --git a/spec/lib/gitlab/gitlab_import/client_spec.rb b/spec/lib/gitlab/gitlab_import/client_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..c511c51547409ac98519b97c4b4de59159c4d139 --- /dev/null +++ b/spec/lib/gitlab/gitlab_import/client_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe Gitlab::GitlabImport::Client do + let(:token) { '123456' } + let(:client) { Gitlab::GitlabImport::Client.new(token) } + + before do + Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "gitlab") + end + + it 'all OAuth2 client options are symbols' do + client.client.options.keys.each do |key| + expect(key).to be_kind_of(Symbol) + end + end +end diff --git a/spec/lib/gitlab/reference_extractor_spec.rb b/spec/lib/gitlab/reference_extractor_spec.rb index 5ebe44f6fb79297f903c7e492819883ddf3567f4..b3f4bb5aeda9137c09206e1409bd0f37da8dd8c8 100644 --- a/spec/lib/gitlab/reference_extractor_spec.rb +++ b/spec/lib/gitlab/reference_extractor_spec.rb @@ -50,6 +50,26 @@ describe Gitlab::ReferenceExtractor do expect(text).to eq('issue #123 is just the worst, @user') end + it 'extracts no references for
..
blocks' do + subject.analyze("
def puts '#1 issue'\nend\n
```", nil) + expect(subject.issues).to be_blank + end + + it 'extracts no references for .. blocks' do + subject.analyze("def puts '!1 request'\nend\n```", nil) + expect(subject.merge_requests).to be_blank + end + + it 'extracts no references for code blocks with language' do + subject.analyze("this code:\n```ruby\ndef puts '#1 issue'\nend\n```", nil) + expect(subject.issues).to be_blank + end + + it 'extracts issue references for invalid code blocks' do + subject.analyze('test: ```this one talks about issue #1234```', nil) + expect(subject.issues).to eq([{ project: nil, id: '1234' }]) + end + it 'handles all possible kinds of references' do accessors = Gitlab::Markdown::TYPES.map { |t| "#{t}s".to_sym } expect(subject).to respond_to(*accessors) diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb index f3fd805783f14f5606681edb5e479fb7bc3f9ea2..fceb7668cac4cf22dcb1b73d97b021ba2137057c 100644 --- a/spec/models/wiki_page_spec.rb +++ b/spec/models/wiki_page_spec.rb @@ -78,6 +78,47 @@ describe WikiPage do end end + describe "dot in the title" do + let(:title) { 'Index v1.2.3' } + + before do + @wiki_attr = {title: title, content: "Home Page", format: "markdown"} + end + + describe "#create" do + after do + destroy_page(title) + end + + context "with valid attributes" do + it "saves the wiki page" do + subject.create(@wiki_attr) + expect(wiki.find_page(title)).not_to be_nil + end + + it "returns true" do + expect(subject.create(@wiki_attr)).to eq(true) + end + end + end + + describe "#update" do + before do + create_page(title, "content") + @page = wiki.find_page(title) + end + + it "updates the content of the page" do + @page.update("new content") + @page = wiki.find_page(title) + end + + it "returns true" do + expect(@page.update("more content")).to be_truthy + end + end + end + describe "#update" do before do create_page("Update", "content")