diff --git a/VERSION b/VERSION index 87db9036a822108fd68f9be0ad2186f2760e1155..ee74734aa2258df77aa09402d55798a1e2e55212 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.1.0rc1 +4.1.0 diff --git a/app/models/repository.rb b/app/models/repository.rb index 6bfdf2255f2b812b7132ec7331660f7ef06d1047..9032905ce9a7b3f39248489476d581374d144629 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) diff --git a/doc/install/installation.md b/doc/install/installation.md index 27c87ec825f737466cca9fe935229b6c7ab39dce..e0744e093e2ee0085552e3764befd5f826ca93c8 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: @@ -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,13 +302,13 @@ 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 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: diff --git a/lib/api/projects.rb b/lib/api/projects.rb index cbef1ed3b5071719134279616d0ef14ba3b0b602..d1f4cad0be3a54881905dfea17e0e435f469b4ea 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -221,6 +221,32 @@ module Gitlab present user_project.repo.heads.sort_by(&:name), with: Entities::RepoObject end + # Protect a single branch + # + # Parameters: + # id (required) - The ID of a project + # branch (required) - The name of the branch + # Example Request: + # GET /projects/:id/repository/branches/:branch/protect + post ":id/repository/branches/:branch/protect" do + @branch = user_project.repo.heads.find { |item| item.name == params[:branch] } + user_project.protected_branches.create(:name => @branch.name) + present @branch, with: Entities::RepoObject + end + + # Unprotect a single branch + # + # Parameters: + # id (required) - The ID of a project + # branch (required) - The name of the branch + # Example Request: + # GET /projects/:id/repository/branches/:branch/unprotect + post ":id/repository/branches/:branch/unprotect" do + @branch = user_project.repo.heads.find { |item| item.name == params[:branch] } + user_project.protected_branches.find_by_name(@branch.name).destroy + present @branch, with: Entities::RepoObject + end + # Get a single branch # # Parameters: diff --git a/lib/gitlab/backend/gitolite_config.rb b/lib/gitlab/backend/gitolite_config.rb index 7d59ddae0c85bc74697866437d2c0f60b7082ff9..1783b2c37b4e08692cd7a7519f02494e3b8ad809 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 diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 826b78ec5b1bc8ff175efa78704215aab5f773ba..e20809cc843e6ec3a50b93743da8ef7b90c63042 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