From e33aa2329936b38568d8621ba427373035a75a6b Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Date: Mon, 21 Jan 2013 15:51:46 +0200 Subject: [PATCH 01/14] Update docs to use 4-1-stable --- doc/install/installation.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index 27c87ec825f..7107d84617b 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -190,10 +190,10 @@ See `doc/install/databases.md` cd /home/gitlab/gitlab # Checkout to stable release - sudo -u gitlab -H git checkout 4-0-stable + sudo -u gitlab -H git checkout 4-1-stable **Note:** -You can change `4-0-stable` to `master` if you want the *bleeding edge* version, but +You can change `4-1-stable` to `master` if you want the *bleeding edge* version, but do so with caution! ## Configure it @@ -267,7 +267,7 @@ used for the `email.from` setting in `config/gitlab.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/4-1-stable/init.d/gitlab sudo chmod +x /etc/init.d/gitlab Make GitLab start on boot: @@ -308,7 +308,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/4-1-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: -- GitLab From 7014c8782bfabf5bc9fadb34d51a57df999fae1d Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Date: Mon, 21 Jan 2013 15:53:00 +0200 Subject: [PATCH 02/14] Up to 4.1.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 87db9036a82..ee74734aa22 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.1.0rc1 +4.1.0 -- GitLab From ed17a011819bfbfdf0cac1542207f391c62deb7b Mon Sep 17 00:00:00 2001 From: Riyad Preukschas <riyad@informatik.uni-bremen.de> Date: Mon, 21 Jan 2013 17:18:00 +0100 Subject: [PATCH 03/14] Fix init script recipe url for 4.1 in check.rake --- lib/tasks/gitlab/check.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 826b78ec5b1..e20809cc843 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/4-1-stable/init.d/gitlab 2>/dev/null` script_content = File.read(script_path) if recipe_content == script_content -- GitLab From 4f1035988d3c38d6913d60202e1af4b82b4e2942 Mon Sep 17 00:00:00 2001 From: Zachary Kjellberg <Zach.Kjellberg@gmail.com> Date: Wed, 23 Jan 2013 15:04:09 -0500 Subject: [PATCH 04/14] Update doc/install/installation.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Line 295:Â sudo /etc/init.d/gitlab restart Results in: "Error, unicorn not running!" This is because unicorn is not yet running for first boot. I suggest changing this to 'start'. Line 305:Â sudo apt-get install nginx Change command to:Â sudo apt-get -y install nginx Allowing automated install to simplify and follow pattern of earlier installs. --- doc/install/installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index 7107d84617b..e0744e093e2 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -292,7 +292,7 @@ However there are still a few steps left. sudo service gitlab start # or - sudo /etc/init.d/gitlab restart + sudo /etc/init.d/gitlab start # 7. Nginx @@ -302,7 +302,7 @@ If you can't or don't want to use Nginx as your web server, have a look at the "Advanced Setup Tips" section. ## Installation - sudo apt-get install nginx + sudo apt-get -y install nginx ## Site Configuration -- GitLab From 26b3050f3749dde769587105af24d4340c57e319 Mon Sep 17 00:00:00 2001 From: McJoppy <github@hudsonstreet.co.nz> Date: Thu, 24 Jan 2013 09:22:14 +1300 Subject: [PATCH 05/14] Update app/models/repository.rb Issue #2699 - Download button not functioning. Replaces slashes with underscore in downloads filename --- app/models/repository.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/repository.rb b/app/models/repository.rb index 6bfdf2255f2..9032905ce9a 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -151,7 +151,7 @@ class Repository return nil unless commit # Build file path - file_name = self.path_with_namespace + "-" + commit.id.to_s + ".tar.gz" + file_name = self.path_with_namespace.gsub("/","_") + "-" + commit.id.to_s + ".tar.gz" storage_path = Rails.root.join("tmp", "repositories") file_path = File.join(storage_path, file_name) -- GitLab From d14069e333fa761678c0b35a7dc6c90f5a95e137 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Date: Fri, 25 Jan 2013 14:35:46 +0200 Subject: [PATCH 06/14] fix deleting non-existing repo --- lib/gitlab/backend/gitolite_config.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/backend/gitolite_config.rb b/lib/gitlab/backend/gitolite_config.rb index 7d59ddae0c8..1783b2c37b4 100644 --- a/lib/gitlab/backend/gitolite_config.rb +++ b/lib/gitlab/backend/gitolite_config.rb @@ -87,7 +87,9 @@ module Gitlab end def destroy_project(project) - FileUtils.rm_rf(project.repository.path_to_repo) + if project.repository + FileUtils.rm_rf(project.repository.path_to_repo) + end conf.rm_repo(project.path_with_namespace) end -- GitLab From 59d91729c833278c518d85d1ba3c24ca21762c46 Mon Sep 17 00:00:00 2001 From: Donny Kurnia <donnykurnia@gmail.com> Date: Mon, 28 Jan 2013 21:53:41 +0700 Subject: [PATCH 07/14] Check if project.repository before check Fix for #2776 --- lib/tasks/gitlab/check.rake | 92 +++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index e20809cc843..b132a48ad23 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -778,23 +778,25 @@ namespace :gitlab do } Project.find_each(batch_size: 100) do |project| - print "#{project.name_with_namespace.yellow} ... " - - correct_options = options.map do |name, value| - run("git --git-dir=\"#{project.repository.path_to_repo}\" config --get #{name}").try(:chomp) == value - end - - if correct_options.all? - puts "ok".green - else - puts "wrong or missing".red - try_fixing_it( - sudo_gitlab("bundle exec rake gitlab:gitolite:update_repos") - ) - for_more_information( - "doc/raketasks/maintenance.md" - ) - fix_and_rerun + if project.repository + print "#{project.name_with_namespace.yellow} ... " + + correct_options = options.map do |name, value| + run("git --git-dir=\"#{project.repository.path_to_repo}\" config --get #{name}").try(:chomp) == value + end + + if correct_options.all? + puts "ok".green + else + puts "wrong or missing".red + try_fixing_it( + sudo_gitlab("bundle exec rake gitlab:gitolite:update_repos") + ) + for_more_information( + "doc/raketasks/maintenance.md" + ) + fix_and_rerun + end end end end @@ -819,33 +821,35 @@ namespace :gitlab do puts "" Project.find_each(batch_size: 100) do |project| - print "#{project.name_with_namespace.yellow} ... " - project_hook_file = File.join(project.repository.path_to_repo, "hooks", hook_file) - - unless File.exists?(project_hook_file) - puts "missing".red - try_fixing_it( - "sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}" - ) - for_more_information( - "lib/support/rewrite-hooks.sh" - ) - fix_and_rerun - next - end - - if File.lstat(project_hook_file).symlink? && - File.realpath(project_hook_file) == File.realpath(gitolite_hook_file) - puts "ok".green - else - puts "not a link to Gitolite's hook".red - try_fixing_it( - "sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}" - ) - for_more_information( - "lib/support/rewrite-hooks.sh" - ) - fix_and_rerun + if project.repository + print "#{project.name_with_namespace.yellow} ... " + project_hook_file = File.join(project.repository.path_to_repo, "hooks", hook_file) + + unless File.exists?(project_hook_file) + puts "missing".red + try_fixing_it( + "sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}" + ) + for_more_information( + "lib/support/rewrite-hooks.sh" + ) + fix_and_rerun + next + end + + if File.lstat(project_hook_file).symlink? && + File.realpath(project_hook_file) == File.realpath(gitolite_hook_file) + puts "ok".green + else + puts "not a link to Gitolite's hook".red + try_fixing_it( + "sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}" + ) + for_more_information( + "lib/support/rewrite-hooks.sh" + ) + fix_and_rerun + end end end end -- GitLab From 506309e17a4ecb78b042df34f9a2495a7aafb459 Mon Sep 17 00:00:00 2001 From: Donny Kurnia <donnykurnia@gmail.com> Date: Mon, 28 Jan 2013 22:07:46 +0700 Subject: [PATCH 08/14] Using empty_repo? instead Display message if repository is empty --- lib/tasks/gitlab/check.rake | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index b132a48ad23..00068abfa02 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -778,9 +778,11 @@ namespace :gitlab do } Project.find_each(batch_size: 100) do |project| - if project.repository - print "#{project.name_with_namespace.yellow} ... " + print "#{project.name_with_namespace.yellow} ... " + if project.empty_repo? + puts "repository is empty".magenta + else correct_options = options.map do |name, value| run("git --git-dir=\"#{project.repository.path_to_repo}\" config --get #{name}").try(:chomp) == value end @@ -821,8 +823,11 @@ namespace :gitlab do puts "" Project.find_each(batch_size: 100) do |project| - if project.repository - print "#{project.name_with_namespace.yellow} ... " + print "#{project.name_with_namespace.yellow} ... " + + if project.empty_repo? + puts "repository is empty".magenta + else project_hook_file = File.join(project.repository.path_to_repo, "hooks", hook_file) unless File.exists?(project_hook_file) -- GitLab From de7012c4fbb998c3599213f9eba62ac8192d2a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Kantoj=C3=A4rvi?= <jaakko@n-1.fi> Date: Wed, 30 Jan 2013 22:14:34 +0200 Subject: [PATCH 09/14] Add option to disable username changing --- app/controllers/profiles_controller.rb | 4 ++- app/views/profiles/account.html.haml | 47 +++++++++++++------------- config/gitlab.yml.example | 1 + config/initializers/1_settings.rb | 1 + 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 1d1efb16f04..1d1850cfedc 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -51,7 +51,9 @@ class ProfilesController < ApplicationController end def update_username - @user.update_attributes(username: params[:user][:username]) + if Gitlab.config.gitlab.username_changing_enabled + @user.update_attributes(username: params[:user][:username]) + end respond_to do |format| format.js diff --git a/app/views/profiles/account.html.haml b/app/views/profiles/account.html.haml index 522e45e637a..b1c02d3ae92 100644 --- a/app/views/profiles/account.html.haml +++ b/app/views/profiles/account.html.haml @@ -53,28 +53,29 @@ -%fieldset.update-username - %legend - Username - %small.cred.right - Changing your username can have unintended side effects! - = form_for @user, url: update_username_profile_path, method: :put, remote: true do |f| - .padded - = f.label :username - .input - = f.text_field :username, required: true - - %span.loading-gif.hide= image_tag "ajax_loader.gif" - %span.update-success.cgreen.hide - %i.icon-ok - Saved - %span.update-failed.cred.hide - %i.icon-remove - Failed - %ul.cred - %li It will change web url for personal projects. - %li It will change the git path to repositories for personal projects. - .input - = f.submit 'Save username', class: "btn save-btn" +- if Gitlab.config.gitlab.username_changing_enabled + %fieldset.update-username + %legend + Username + %small.cred.right + Changing your username can have unintended side effects! + = form_for @user, url: update_username_profile_path, method: :put, remote: true do |f| + .padded + = f.label :username + .input + = f.text_field :username, required: true + + %span.loading-gif.hide= image_tag "ajax_loader.gif" + %span.update-success.cgreen.hide + %i.icon-ok + Saved + %span.update-failed.cred.hide + %i.icon-remove + Failed + %ul.cred + %li It will change web url for personal projects. + %li It will change the git path to repositories for personal projects. + .input + = f.submit 'Save username', class: "btn save-btn" diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index b2dccbe3d4c..4b2f69ab5fe 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -35,6 +35,7 @@ gitlab: ## Project settings default_projects_limit: 10 # signup_enabled: true # default: false - Account passwords are not sent via the email if signup is enabled. + # username_changing_enabled: false # default: true - User can change her username/namespace ## Gravatar gravatar: diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index a1afa5b22c4..0334b35ec91 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -53,6 +53,7 @@ Settings.gitlab['support_email'] ||= Settings.gitlab.email_from Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url) Settings.gitlab['user'] ||= 'gitlab' Settings.gitlab['signup_enabled'] ||= false +Settings.gitlab['username_changing_enabled'] = true if Settings.gitlab['username_changing_enabled'].nil? Settings['gravatar'] ||= Settingslogic.new({}) Settings.gravatar['enabled'] = true if Settings.gravatar['enabled'].nil? -- GitLab From fcffb4c3813d037346c7c967fcc490dc529c976b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Kantoj=C3=A4rvi?= <jaakko@n-1.fi> Date: Sat, 2 Feb 2013 21:25:03 +0200 Subject: [PATCH 10/14] Move username change decision into user model --- app/controllers/profiles_controller.rb | 2 +- app/models/user.rb | 4 ++++ app/views/profiles/account.html.haml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 1d1850cfedc..051a6664519 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -51,7 +51,7 @@ class ProfilesController < ApplicationController end def update_username - if Gitlab.config.gitlab.username_changing_enabled + if @user.can_change_username? @user.update_attributes(username: params[:user][:username]) end diff --git a/app/models/user.rb b/app/models/user.rb index 35a693fdb1c..d66ce411286 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -215,6 +215,10 @@ class User < ActiveRecord::Base keys.count == 0 end + def can_change_username? + Gitlab.config.gitlab.username_changing_enabled + end + def can_create_project? projects_limit > personal_projects.count end diff --git a/app/views/profiles/account.html.haml b/app/views/profiles/account.html.haml index b1c02d3ae92..ea9bcb648de 100644 --- a/app/views/profiles/account.html.haml +++ b/app/views/profiles/account.html.haml @@ -53,7 +53,7 @@ -- if Gitlab.config.gitlab.username_changing_enabled +- if current_user.can_change_username? %fieldset.update-username %legend Username -- GitLab From 7c87eed6b967cc7b7715496aa117c4c47aebd0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Kantoj=C3=A4rvi?= <jaakko@n-1.fi> Date: Mon, 4 Feb 2013 13:12:10 +0200 Subject: [PATCH 11/14] Change .gitignore to ignore logrotated log files. --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b1f4229925a..72abdd52ab9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ .rbx/ db/*.sqlite3 db/*.sqlite3-journal -log/*.log +log/*.log* tmp/ .sass-cache/ coverage/* -- GitLab From 385a515d2bf63d4d5179ebb1a880f52225756845 Mon Sep 17 00:00:00 2001 From: Erwan Arzur <earzur@runmyprocess.com> Date: Tue, 22 Jan 2013 19:07:11 +0100 Subject: [PATCH 12/14] [import] - fix project import after refactoring --- lib/tasks/gitlab/import.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/gitlab/import.rake b/lib/tasks/gitlab/import.rake index 4bf9110508e..0ca652faa74 100644 --- a/lib/tasks/gitlab/import.rake +++ b/lib/tasks/gitlab/import.rake @@ -44,7 +44,7 @@ namespace :gitlab do :name => path, } - project = Project.create_by_user(project_params, user) + project = Projects::CreateContext.new(user, project_params).execute if project.valid? puts " * Created #{project.name} (#{repo_name})".green -- GitLab From 09d977322e699ec31bbe6df7b61e75e46905d809 Mon Sep 17 00:00:00 2001 From: Alexander frenzel <alex@relatedworks.com> Date: Thu, 7 Feb 2013 14:52:54 +0100 Subject: [PATCH 13/14] import repositories to global namespace --- lib/tasks/gitlab/import.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/gitlab/import.rake b/lib/tasks/gitlab/import.rake index 0ca652faa74..29e5847b81e 100644 --- a/lib/tasks/gitlab/import.rake +++ b/lib/tasks/gitlab/import.rake @@ -42,6 +42,7 @@ namespace :gitlab do project_params = { :name => path, + :namespace_id => Namespace.global_id, } project = Projects::CreateContext.new(user, project_params).execute -- GitLab From 4989204a100815859a91c657e3a3b0fd13a7aa6d Mon Sep 17 00:00:00 2001 From: Stephen Lottermoser <holdtotherod@gmail.com> Date: Sat, 16 Feb 2013 11:37:42 -0800 Subject: [PATCH 14/14] Update doc/install/installation.md Fixed wording of an installation step. --- doc/install/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index e0744e093e2..aa3137d1d59 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -149,7 +149,7 @@ Fix the directory permissions for the repositories: sudo chown -R git:git /home/git/repositories/ -## Add domains to list to the list of known hosts +## Add domains to the list of known hosts sudo -u gitlab -H ssh git@localhost sudo -u gitlab -H ssh git@YOUR_DOMAIN_NAME -- GitLab