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 1/7] 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 2/7] 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 3/7] 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 4/7] 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 5/7] 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 6/7] 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 0954bd3c5fd36fcaaba6e05c58325ea835fe2dca Mon Sep 17 00:00:00 2001
From: Matt Humphrey <matt@tomatto.co.uk>
Date: Fri, 25 Jan 2013 14:58:43 +0000
Subject: [PATCH 7/7] Added methods to protect and unprotect branches.

---
 lib/api/projects.rb | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index cbef1ed3b50..d1f4cad0be3 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:
-- 
GitLab