From 08e52b08073fdba741b79206d79c4b26528fd1c5 Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Mon, 22 Apr 2013 12:38:50 +0200
Subject: [PATCH 01/10] Fix version mismatch for installations docs

---
 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 d1d3833e3d2..002d8c596f4 100644
--- a/doc/install/installation.md
+++ b/doc/install/installation.md
@@ -132,10 +132,10 @@ To setup the MySQL/PostgreSQL database and dependencies please see [`doc/install
     cd /home/git/gitlab
 
     # Checkout to stable release
-    sudo -u git -H git checkout 5-0-stable
+    sudo -u git -H git checkout 5-1-stable
 
 **Note:**
-You can change `5-0-stable` to `master` if you want the *bleeding edge* version, but
+You can change `5-1-stable` to `master` if you want the *bleeding edge* version, but
 do so with caution!
 
 ## Configure it
@@ -200,7 +200,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-1-stable/init.d/gitlab
     sudo chmod +x /etc/init.d/gitlab
 
 Make GitLab start on boot:
@@ -241,7 +241,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-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 80efbf8544d636acbc3a56c6b3c77a80e33efd04 Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Mon, 22 Apr 2013 16:13:04 +0300
Subject: [PATCH 02/10] Replace unicorn with puma

---
 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 002d8c596f4..90f93e84db6 100644
--- a/doc/install/installation.md
+++ b/doc/install/installation.md
@@ -162,8 +162,8 @@ do so with caution!
     sudo -u git -H mkdir tmp/pids/
     sudo chmod -R u+rwX  tmp/pids/
 
-    # Copy the example Unicorn config
-    sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
+    # Copy the example Of Puma config
+    sudo -u git -H cp config/puma.rb.example config/puma.rb
 
 **Important Note:**
 Make sure to edit both files to match your setup.
-- 
GitLab


From d4e7aa4fe089eb6a4eef1da33d8ec124a4b7aba0 Mon Sep 17 00:00:00 2001
From: Sato Hiroyuki <sathiroyuki@gmail.com>
Date: Tue, 23 Apr 2013 09:23:59 +0900
Subject: [PATCH 03/10] Fix error "Address already in use".

---
 doc/update/5.0-to-5.1.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/doc/update/5.0-to-5.1.md b/doc/update/5.0-to-5.1.md
index 438bc25672c..f9fbeaf7870 100644
--- a/doc/update/5.0-to-5.1.md
+++ b/doc/update/5.0-to-5.1.md
@@ -19,6 +19,7 @@ sudo -u git -H git checkout 5-1-stable
 ### 3. Install libs, migrations etc
 
 ```
+sudo rm tmp/sockets/gitlab.socket
 sudo -u git -H cp config/puma.rb.example config/puma.rb
 
 
-- 
GitLab


From 4faf64a9a101cb5748617834932576dc1f4d3b1a Mon Sep 17 00:00:00 2001
From: Daniel Nieto <daniel.nieto@ironbit.net>
Date: Tue, 23 Apr 2013 17:03:29 -0500
Subject: [PATCH 04/10] 5.0-to-5.1.md - gitlab-shell update instructions.

---
 doc/update/5.0-to-5.1.md | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/doc/update/5.0-to-5.1.md b/doc/update/5.0-to-5.1.md
index f9fbeaf7870..d3abe462971 100644
--- a/doc/update/5.0-to-5.1.md
+++ b/doc/update/5.0-to-5.1.md
@@ -16,7 +16,15 @@ sudo -u git -H git checkout 5-1-stable
 
 ```
 
-### 3. Install libs, migrations etc
+### 3. Update gitlab-shell
+
+```
+cd /home/git/gitlab-shell
+sudo -u git -H git fetch
+sudo -u git -H git checkout v1.3.0
+```
+
+### 4. Install libs, migrations etc
 
 ```
 sudo rm tmp/sockets/gitlab.socket
@@ -29,7 +37,7 @@ sudo -u git -H bundle exec rake migrate_merge_requests RAILS_ENV=production
 
 ```
 
-### 4. Update init.d script with a new one
+### 5. Update init.d script with a new one
 
 ```bash
 # init.d
@@ -38,6 +46,6 @@ sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-rec
 sudo chmod +x /etc/init.d/gitlab
 ```
 
-### 5. Start application
+### 6. Start application
 
     sudo service gitlab start
-- 
GitLab


From 87aed8d4b93fa037f2cd55b9f6f342f40cc015f9 Mon Sep 17 00:00:00 2001
From: David Greaves <david@dgreaves.com>
Date: Wed, 24 Apr 2013 18:28:08 +0100
Subject: [PATCH 05/10] Make absolutely sure we're in the right place when
 executing commands that depend on CWD

Signed-off-by: David Greaves <david.greaves@jollamobile.com>
---
 doc/update/5.0-to-5.1.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/update/5.0-to-5.1.md b/doc/update/5.0-to-5.1.md
index d3abe462971..5e10bf16699 100644
--- a/doc/update/5.0-to-5.1.md
+++ b/doc/update/5.0-to-5.1.md
@@ -10,7 +10,7 @@
 ### 2. get latest code
 
 ```
-
+cd /home/git/gitlab
 sudo -u git -H git fetch
 sudo -u git -H git checkout 5-1-stable
 
@@ -27,6 +27,7 @@ sudo -u git -H git checkout v1.3.0
 ### 4. Install libs, migrations etc
 
 ```
+cd /home/git/gitlab
 sudo rm tmp/sockets/gitlab.socket
 sudo -u git -H cp config/puma.rb.example config/puma.rb
 
-- 
GitLab


From 5b814f20438b6e2f734d42f48475083b657e9d44 Mon Sep 17 00:00:00 2001
From: Jan Segre <jan@vialink.com.br>
Date: Thu, 25 Apr 2013 17:07:41 -0300
Subject: [PATCH 06/10] Fixing error 500 on /groups and /teams.

Although these urls do not exist they were being mapped with rails
resources. I've added an exception not to add the index routes. Now they
will yield 404 errors instead of 500 ones when trying to access /groups
or /teams.
---
 config/routes.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config/routes.rb b/config/routes.rb
index 18475e03277..4838d97a4ea 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -133,7 +133,7 @@ Gitlab::Application.routes.draw do
   #
   # Groups Area
   #
-  resources :groups, constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/}  do
+  resources :groups, constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/}, except: [:index] do
     member do
       get :issues
       get :merge_requests
@@ -146,7 +146,7 @@ Gitlab::Application.routes.draw do
   #
   # Teams Area
   #
-  resources :teams, constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} do
+  resources :teams, constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/}, except: [:index] do
     member do
       get :issues
       get :merge_requests
-- 
GitLab


From 20df7b12cafd65fb95c208c3da39b9abf2114c2e Mon Sep 17 00:00:00 2001
From: David Greaves <david@dgreaves.com>
Date: Mon, 1 Apr 2013 17:51:05 +0100
Subject: [PATCH 07/10] Change text_field to :login from :email in line with
 9d92433a7c83432657faf4c02839bba1ba6f22ac to allow login as admin or non-ldap
 user when ldap is enabled Also change haml style in line with that commit

---
 app/views/devise/sessions/_new_ldap.html.haml | 26 +++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/app/views/devise/sessions/_new_ldap.html.haml b/app/views/devise/sessions/_new_ldap.html.haml
index eb8c5194607..29ba9c1e99c 100644
--- a/app/views/devise/sessions/_new_ldap.html.haml
+++ b/app/views/devise/sessions/_new_ldap.html.haml
@@ -1,29 +1,29 @@
-= form_tag(user_omniauth_callback_path(:ldap), :class => "login-box", :id => 'new_ldap_user' ) do
-  = image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo"
-  = text_field_tag :username, nil, {:class => "text top", :placeholder => "LDAP Login", :autofocus => "autofocus"}
-  = password_field_tag :password, nil, {:class => "text bottom", :placeholder => "Password"}
+= form_tag(user_omniauth_callback_path(:ldap), class: "login-box", id: 'new_ldap_user' ) do
+  = image_tag "login-logo.png", width: "304", height: "66", class: "login-logo", alt: "Login Logo"
+  = text_field_tag :username, nil, {class: "text top", placeholder: "LDAP Login", autofocus: "autofocus"}
+  = password_field_tag :password, nil, {class: "text bottom", placeholder: "Password"}
   %br/
-  = submit_tag "LDAP Sign in", :class => "btn-primary btn"
+  = submit_tag "LDAP Sign in", class: "btn-primary btn"
   - if devise_mapping.omniauthable?
     - (resource_class.omniauth_providers - [:ldap]).each do |provider|
       %hr/
-      = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn btn-primary"
+      = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), class: "btn btn-primary"
       %br/
   %hr/
-  %a#other_form_toggle{:href => "#", :onclick => "javascript:$('#new_user').toggle();"} Other Sign in
+  %a#other_form_toggle{href: "#", onclick: "javascript:$('#new_user').toggle();"} Other Sign in
   :javascript
     $(function() {
       $('#new_user').toggle();
     });
-= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "login-box" }) do |f|
-  = f.text_field :email, :class => "text top", :placeholder => "Email"
-  = f.password_field :password, :class => "text bottom", :placeholder => "Password"
+= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "login-box" }) do |f|
+  = f.text_field :login, class: "text top", placeholder: "Username or Email", autofocus: "autofocus"
+  = f.password_field :password, class: "text bottom", placeholder: "Password"
   - if devise_mapping.rememberable?
     .clearfix.inputs-list
-      %label.checkbox.remember_me{:for => "user_remember_me"}
+      %label.checkbox.remember_me{for: "user_remember_me"}
         = f.check_box :remember_me
         %span Remember me
   %br/
-  = f.submit "Sign in", :class => "btn-primary btn"
+  = f.submit "Sign in", class: "btn-primary btn"
   .pull-right
-    = render :partial => "devise/shared/links"
+    = render partial: "devise/shared/links"
-- 
GitLab


From 830afbc3d2cff5c8c22f18c4b266d08019b34039 Mon Sep 17 00:00:00 2001
From: Axilleas Pipinellis <axilleas@archlinux.gr>
Date: Sun, 28 Apr 2013 08:22:35 +0300
Subject: [PATCH 08/10] New mysql privilege, fixed path for init.d
 check(#3757), create sockets dir(#3639)

---
 doc/install/installation.md |  6 ++++--
 doc/update/5.0-to-5.1.md    | 25 ++++++++++++++++---------
 lib/tasks/gitlab/check.rake |  2 +-
 3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/doc/install/installation.md b/doc/install/installation.md
index 90f93e84db6..c81a3af5c3a 100644
--- a/doc/install/installation.md
+++ b/doc/install/installation.md
@@ -158,11 +158,13 @@ do so with caution!
     # Create directory for satellites
     sudo -u git -H mkdir /home/git/gitlab-satellites
 
-    # Create directory for pids and make sure GitLab can write to it
+    # Create directories for sockets/pids and make sure GitLab can write to them
     sudo -u git -H mkdir tmp/pids/
+    sudo -u git -H mkdir tmp/sockets/
     sudo chmod -R u+rwX  tmp/pids/
+    sudo chmod -R u+rwX  tmp/sockets/
 
-    # Copy the example Of Puma config
+    # Copy the example of Puma config
     sudo -u git -H cp config/puma.rb.example config/puma.rb
 
 **Important Note:**
diff --git a/doc/update/5.0-to-5.1.md b/doc/update/5.0-to-5.1.md
index 5e10bf16699..708d33ecb6f 100644
--- a/doc/update/5.0-to-5.1.md
+++ b/doc/update/5.0-to-5.1.md
@@ -3,22 +3,21 @@
 * `unicorn` replaced with `puma`
 * merge request cached diff will be truncated
 
-### 1. stop server
+### 1. Stop server
 
     sudo service gitlab stop
 
-### 2. get latest code
+### 2. Get latest code
 
-```
+```bash
 cd /home/git/gitlab
 sudo -u git -H git fetch
 sudo -u git -H git checkout 5-1-stable
-
 ```
 
 ### 3. Update gitlab-shell
 
-```
+```bash
 cd /home/git/gitlab-shell
 sudo -u git -H git fetch
 sudo -u git -H git checkout v1.3.0
@@ -26,16 +25,14 @@ sudo -u git -H git checkout v1.3.0
 
 ### 4. Install libs, migrations etc
 
-```
+```bash
 cd /home/git/gitlab
 sudo rm tmp/sockets/gitlab.socket
 sudo -u git -H cp config/puma.rb.example config/puma.rb
 
-
 sudo -u git -H bundle install --without development test postgres --deployment
 sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
 sudo -u git -H bundle exec rake migrate_merge_requests RAILS_ENV=production
-
 ```
 
 ### 5. Update init.d script with a new one
@@ -47,6 +44,16 @@ sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-rec
 sudo chmod +x /etc/init.d/gitlab
 ```
 
-### 6. Start application
+### 6. Mysql grant privileges
+
+Only if you are using mysql:
+
+```bash
+mysql -u root -p
+mysql> GRANT LOCK TABLES ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
+mysql> \q
+```
+
+### 7. Start application
 
     sudo service gitlab start
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index 94599ae880b..a57c3494ec8 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -143,7 +143,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-1-stable/init.d/gitlab 2>/dev/null`
       script_content = File.read(script_path)
 
       if recipe_content == script_content
-- 
GitLab


From 0ff2e5f69b14dbe5fce7743f032641fe25b03015 Mon Sep 17 00:00:00 2001
From: zenmonkeykstop <kevin.ogorman@gmail.com>
Date: Mon, 29 Apr 2013 16:34:02 -0300
Subject: [PATCH 09/10] Update 5.0-to-5.1.md

Update instructions are mysql-specific. Added a line for Postgres users
---
 doc/update/5.0-to-5.1.md | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/doc/update/5.0-to-5.1.md b/doc/update/5.0-to-5.1.md
index 708d33ecb6f..b827d868926 100644
--- a/doc/update/5.0-to-5.1.md
+++ b/doc/update/5.0-to-5.1.md
@@ -29,8 +29,17 @@ sudo -u git -H git checkout v1.3.0
 cd /home/git/gitlab
 sudo rm tmp/sockets/gitlab.socket
 sudo -u git -H cp config/puma.rb.example config/puma.rb
-
+```
+If you are using MySQL:
+```
 sudo -u git -H bundle install --without development test postgres --deployment
+```
+If you are using PostgreSQL:
+```
+sudo -u git -H bundle install --without development test mysql --deployment
+```
+
+```
 sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
 sudo -u git -H bundle exec rake migrate_merge_requests RAILS_ENV=production
 ```
@@ -44,9 +53,9 @@ sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-rec
 sudo chmod +x /etc/init.d/gitlab
 ```
 
-### 6. Mysql grant privileges
+### 6. MySQL grant privileges
 
-Only if you are using mysql:
+Only if you are using MySQL:
 
 ```bash
 mysql -u root -p
-- 
GitLab


From 195be735f8199a16407e96fe3fbe5e3343f3c022 Mon Sep 17 00:00:00 2001
From: b4nd0ler0 <b4nd0ler0@hotmail.com>
Date: Thu, 2 May 2013 14:44:55 +0300
Subject: [PATCH 10/10] Prepend  "sudo -u git -H" to backup bundle exec
 commands

Add "cd /home/git/gitlab" prior to execution of bundle exec commands.
Prepend  "sudo -u git -H" to backup bundle exec commands.
---
 doc/raketasks/backup_restore.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md
index d2da64f3d3c..0a201658fb2 100644
--- a/doc/raketasks/backup_restore.md
+++ b/doc/raketasks/backup_restore.md
@@ -3,7 +3,10 @@
 Creates a backup archive of the database and all repositories. This archive will be saved in backup_path (see `config/gitlab.yml`).
 The filename will be `[TIMESTAMP]_gitlab_backup.tar`. This timestamp can be used to restore an specific backup.
 
+
+
 ```
+cd /home/git/gitlab
 bundle exec rake gitlab:backup:create RAILS_ENV=production
 ```
 
@@ -39,6 +42,7 @@ Deleting old backups... [SKIPPING]
 ### Restore a previously created backup
 
 ```
+cd /home/git/gitlab
 bundle exec rake gitlab:backup:restore RAILS_ENV=production
 ```
 
-- 
GitLab