diff --git a/CHANGELOG b/CHANGELOG index 62792fcf5a67ea381af02209804b58a30791ea1f..dbe60f4650b546ec727cf8f26bf504d6d6e3bde5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +v 5.0.1 + - Fixed issue with gitlab-grit being overrided by grit + v 5.0.0 - Replaced gitolite with gitlab-shell - Removed gitolite-related libraries diff --git a/Gemfile b/Gemfile index 7f92cb75d30678d9f8ca9b471649854719774cd3..312b67767ac90b03248bdfd8935a7ccdb9056082 100644 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,8 @@ gem 'omniauth-twitter' gem 'omniauth-github' # Extracting information from a git repository -gem "gitlab-grit", '~> 1.0.0', require: 'grit' +# Since gollum requires grit we cannot use gitlab-grit gem name any more. Use grit instead +gem "grit", '~> 2.5.0', git: 'https://github.com/gitlabhq/grit.git', ref: 'c40a32432616a07fa7fc3c32c24ab73ad6a9718f' gem 'grit_ext', '~> 0.6.2' # Ruby/Rack Git Smart-HTTP Server Handler @@ -104,7 +105,7 @@ gem 'settingslogic' # github-linquist needs pygments 0.4.2 but Gollum 2.4.11 # requires pygments 0.3.2. The latest master Gollum has been updated # to use pygments 0.4.2. Change this after next Gollum release. -gem "gollum", "~> 2.4.0", git: "git://github.com/gollum/gollum.git", ref: "5dcd3c8c8f" +gem "gollum", "~> 2.4.0", git: "https://github.com/gollum/gollum.git", ref: "5dcd3c8c8f" # Misc gem "foreman" diff --git a/Gemfile.lock b/Gemfile.lock index 4de5c893ff88a3bb547cb5fe4551551f498df338..bae30ac36adb07e10d397d131412d2225678ebe7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,5 @@ GIT - remote: git://github.com/gollum/gollum.git + remote: https://github.com/gollum/gollum.git revision: 5dcd3c8c8f68158e43ff79861279088ee56d0ebe ref: 5dcd3c8c8f specs: @@ -23,6 +23,16 @@ GIT activerecord (>= 2.3.0) rake (>= 0.8.7) +GIT + remote: https://github.com/gitlabhq/grit.git + revision: c40a32432616a07fa7fc3c32c24ab73ad6a9718f + ref: c40a32432616a07fa7fc3c32c24ab73ad6a9718f + specs: + grit (2.5.0) + diff-lcs (~> 1.1) + mime-types (~> 1.15) + posix-spawn (~> 0.3.6) + GIT remote: https://github.com/gitlabhq/raphael-rails.git revision: cb2c92a040b9b941a5f1aa1ea866cc26e944fe58 @@ -166,10 +176,6 @@ GEM github-markup (0.7.5) gitlab-grack (1.0.0) rack (~> 1.4.1) - gitlab-grit (1.0.0) - diff-lcs (~> 1.1) - mime-types (~> 1.15) - posix-spawn (~> 0.3.6) gitlab-pygments.rb (0.3.2) posix-spawn (~> 0.3.6) yajl-ruby (~> 1.1.0) @@ -194,10 +200,6 @@ GEM grape-entity (0.2.0) activesupport multi_json (>= 1.3.2) - grit (2.5.0) - diff-lcs (~> 1.1) - mime-types (~> 1.15) - posix-spawn (~> 0.3.6) grit_ext (0.6.2) charlock_holmes (~> 0.6.9) growl (1.0.3) @@ -521,7 +523,6 @@ DEPENDENCIES github-linguist (~> 2.3.4) github-markup (~> 0.7.4) gitlab-grack (~> 1.0.0) - gitlab-grit (~> 1.0.0) gitlab-pygments.rb (~> 0.3.2) gitlab_meta (= 5.0) gitlab_omniauth-ldap (= 1.0.2) @@ -530,6 +531,7 @@ DEPENDENCIES gon grape (~> 0.3.1) grape-entity (~> 0.2.0) + grit (~> 2.5.0)! grit_ext (~> 0.6.2) growl guard-rspec diff --git a/VERSION b/VERSION index 0062ac971805f7b700058db4bb0f5c5b771dda76..6b244dcd6960b101b0ab4d9e5162d39632dec80c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.0.0 +5.0.1 diff --git a/app/assets/stylesheets/sections/commits.scss b/app/assets/stylesheets/sections/commits.scss index 0df39298c89768116290234f073f1ef53ae87b2d..1e564188892cfa0ae23b59474fe34cea8ea174da 100644 --- a/app/assets/stylesheets/sections/commits.scss +++ b/app/assets/stylesheets/sections/commits.scss @@ -413,3 +413,9 @@ padding: 4px; background-color: #EEE; } + +.commit-description { + background: none; + border: none; + margin: 0; +} diff --git a/app/views/blame/_head.html.haml b/app/views/blame/_head.html.haml index ef9e6c9c53288280e7147b2f57b419ef3f150046..3a8838295621fb993c7d291deb7cf8daa4c585ca 100644 --- a/app/views/blame/_head.html.haml +++ b/app/views/blame/_head.html.haml @@ -1,7 +1,2 @@ -%ul.nav.nav-tabs - %li - = render partial: 'shared/ref_switcher', locals: {destination: 'tree', path: params[:path]} - = nav_link(controller: :refs) do - = link_to 'Source', project_tree_path(@project, @ref) - %li.pull-right - = render "shared/clone_panel" +%div.tree-ref-holder + = render 'shared/ref_switcher', destination: 'tree', path: params[:path] diff --git a/app/views/blame/show.html.haml b/app/views/blame/show.html.haml index 36d81e6af38767b2748ab7d779068caa7f6c0b00..b2a45ef5303300d962cfc98cbffca9019dda3f5e 100644 --- a/app/views/blame/show.html.haml +++ b/app/views/blame/show.html.haml @@ -3,7 +3,7 @@ #tree-holder.tree-holder %ul.breadcrumb %li - %span.arrow + %i.icon-angle-right = link_to project_tree_path(@project, @ref) do = @project.name - @tree.breadcrumbs(6) do |link| @@ -39,8 +39,10 @@ - else - lines.each do |line| = current_line + \ - current_line += 1 %td.lines %pre - lines.each do |line| = line + \ diff --git a/doc/install/installation.md b/doc/install/installation.md index 69d3b186b3201a459a2d2b5b7f6d04bd277a6e1f..0ddd2cc546202a71b7c514e86fa34e2cb1bc3184 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -1,6 +1,6 @@ This installation guide was created for Debian/Ubuntu and tested on it. Please read [`doc/install/requirements.md`](./requirements.md) for hardware and platform requirements. -This installation guide is recommended to set up a production server. If you want a development environment please use the [Vargrant virtual machine](https://github.com/gitlabhq/gitlab-vagrant-vm) since it makes it much easier to set up all the dependencies for integration testing. +This installation guide is recommended to set up a production server. If you want a development environment please use the [Vagrant virtual machine](https://github.com/gitlabhq/gitlab-vagrant-vm) since it makes it much easier to set up all the dependencies for integration testing. **Important Note:** The following steps have been known to work. @@ -106,6 +106,11 @@ GitLab Shell is a ssh access and repository management software developed specia git clone https://github.com/gitlabhq/gitlab-shell.git cd gitlab-shell + + # switch to right version for v5.0 + git checkout v1.1.0 + git checkout -b v1.1.0 + cp config.yml.example config.yml # Edit config and replace gitlab_url @@ -203,7 +208,7 @@ Make sure to update username/password in config/database.yml. Download the init script (will be /etc/init.d/gitlab): - sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab + sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-0-stable/init.d/gitlab sudo chmod +x /etc/init.d/gitlab Make GitLab start on boot: @@ -244,7 +249,7 @@ If you can't or don't want to use Nginx as your web server, have a look at the Download an example site config: - sudo curl --output /etc/nginx/sites-available/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/nginx/gitlab + sudo curl --output /etc/nginx/sites-available/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-0-stable/nginx/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab Make sure to edit the config file to match your setup: diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 855227fb34f5c7d28567600103fd7a6b708bb0a3..b30079ff4833f4f389c3fe73d57e5762cc2f27a6 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -142,7 +142,7 @@ namespace :gitlab do return end - recipe_content = `curl https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab 2>/dev/null` + recipe_content = `curl https://raw.github.com/gitlabhq/gitlab-recipes/5-0-stable/init.d/gitlab 2>/dev/null` script_content = File.read(script_path) if recipe_content == script_content diff --git a/lib/tasks/gitlab/migrate_wiki.rake b/lib/tasks/gitlab/migrate_wiki.rake index 5d9881e45db8d4a135878c6b3931faaf8c2db3bb..9198a398c82b4b11933e86c03d7da0681a5e4ff7 100644 --- a/lib/tasks/gitlab/migrate_wiki.rake +++ b/lib/tasks/gitlab/migrate_wiki.rake @@ -11,7 +11,13 @@ namespace :gitlab do # Notes: # * The existing Wiki content will remain in your # database in-tact. - desc "GITLAB | Migrate Wiki content from database to Gollum repositories." + # * If the migration does not work the first time, + # run the `RAILS_ENV=production rake gitlab:wiki:rollback` + # command and then execute the migration again with + # the safe_migrate=true environment variable: + # + # `RAILS_ENV=production rake gitlab:wiki:migrate safe_migrate=true` + desc "GITLAB | Migrate Wiki content from database to Gollum repositories. Use the safe_migrate=true argument if initial migration fails." task :migrate => :environment do wiki_migrator = WikiToGollumMigrator.new wiki_migrator.migrate! diff --git a/lib/wiki_to_gollum_migrator.rb b/lib/wiki_to_gollum_migrator.rb index ed6a17006310c6f4e2ffbd1be2ff2765448c53f1..8f9218bbc91bc7fa5de3e76a02bdc39d8d7bb188 100644 --- a/lib/wiki_to_gollum_migrator.rb +++ b/lib/wiki_to_gollum_migrator.rb @@ -1,3 +1,5 @@ +# encoding: UTF-8 + class WikiToGollumMigrator attr_reader :projects @@ -53,7 +55,7 @@ class WikiToGollumMigrator def create_page_and_revisions(project, page) # Grab all revisions of the page - revisions = project.wikis.where(slug: page.slug).ordered.all + revisions = project.wikis.where(slug: page.slug).order('id desc').all # Remove the first revision created from the array # and use it to create the Gollum page. Each successive revision @@ -84,7 +86,7 @@ class WikiToGollumMigrator # and revision created so the correct User is shown in # the commit message. wiki = GollumWiki.new(project, revision.user) - wiki_page = wiki.find_page(page.slug) + wiki_page = wiki.find_page(page.title) attributes = extract_attributes_from_page(revision, project) @@ -103,6 +105,10 @@ class WikiToGollumMigrator .with_indifferent_access .slice(:title, :content) + if ENV["safe_migrate"] == "true" + attributes[:title] = gollum_safe_title(attributes[:title]) + end + slug = page.slug # Change 'index' pages to 'home' pages to match Gollum standards @@ -113,6 +119,10 @@ class WikiToGollumMigrator attributes end + def gollum_safe_title(title) + title.parameterize.titleize + end + def home_already_exists?(project) project.wikis.where(slug: 'home').any? || project.wikis.where(slug: 'Home').any? end diff --git a/spec/lib/wiki_to_gollum_migrator_spec.rb b/spec/lib/wiki_to_gollum_migrator_spec.rb index f9b9c78ea01131869ef20c8f9019e9ac27d023c0..4740839bc77ded70a7d6f7e396bc6d0a9bcb6f24 100644 --- a/spec/lib/wiki_to_gollum_migrator_spec.rb +++ b/spec/lib/wiki_to_gollum_migrator_spec.rb @@ -1,3 +1,5 @@ +# encoding: UTF-8 + require "spec_helper" describe WikiToGollumMigrator do @@ -137,6 +139,99 @@ describe WikiToGollumMigrator do end end + context "when migrating wiki's with extra whitespace in the title" do + before do + subject.rollback! + ENV['safe_migrate'] = 'true' + @project = @projects.last + @page = @project.wikis.new(title: "2012-06-16 ", content: "Page with funky title") + @page.slug = @page.title.parameterize + @page.user = @project.owner + @page.save! + + 3.times { create_revision(@page) } + + subject.migrate! + end + + it "creates the wiki page correctly" do + wiki = GollumWiki.new(@project, nil) + page = wiki.find_page("2012 06 16") + page.should be_present + page.content.should == "Updated Content" + page.versions.count.should == 2 + end + end + + context "when migrating wiki's with slashes in the title" do + before do + subject.rollback! + ENV['safe_migrate'] = 'true' + @project = @projects.last + @page = @project.wikis.new(title: "Awesome 1337 /bin/badass ", content: "Page with funky title") + @page.slug = @page.title.parameterize + @page.user = @project.owner + @page.save! + + create_revision(@page) + + subject.migrate! + end + + it "creates the wiki page correctly" do + wiki = GollumWiki.new(@project, nil) + page = wiki.find_page("Awesome 1337 Bin Badass") + page.should be_present + page.versions.count.should == 2 + end + end + + context "when migrating wiki's with non alphanumeric characters in the title" do + before do + subject.rollback! + ENV['safe_migrate'] = 'true' + @project = @projects.last + @page = @project.wikis.new(title: "Awes@me-1337 #!/bin/badass? ", content: "Page with funky title") + @page.slug = @page.title.parameterize + @page.user = @project.owner + @page.save! + + create_revision(@page) + + subject.migrate! + end + + it "creates the wiki page correctly" do + wiki = GollumWiki.new(@project, nil) + page = wiki.find_page("Awes Me 1337 Bin Badass") + page.should be_present + page.versions.count.should == 2 + end + end + + context "when migrating wiki's with non-english characters in the title" do + before do + subject.rollback! + ENV['safe_migrate'] = 'true' + @project = @projects.last + @page = @project.wikis.new(title: "Mögliche Aufteilung", content: "Page with funky title") + @page.slug = @page.title.parameterize + @page.user = @project.owner + @page.save! + + create_revision(@page) + + subject.migrate! + end + + it "creates the wiki page correctly" do + wiki = GollumWiki.new(@project, nil) + page = wiki.find_page("Mogliche Aufteilung") + page.should be_present + page.versions.count.should == 2 + end + end + context "changing wiki title from index to home" do before do @project = @projects.last