From 1150bad21fc37f0ed3864eb64f96fac29433c70c Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Thu, 23 Jan 2014 10:08:26 +0200
Subject: [PATCH 1/6] Fix selectbox when submit MR from fork to origin

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
---
 app/controllers/projects/merge_requests_controller.rb     | 4 ++++
 app/views/projects/merge_requests/update_branches.js.haml | 8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index 0792dbf041f..c66f3de6263 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -152,6 +152,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
     @target_project = selected_target_project
     @target_branches = @target_project.repository.branch_names
     @target_branches
+
+    respond_to do |format|
+      format.js
+    end
   end
 
   def ci_status
diff --git a/app/views/projects/merge_requests/update_branches.js.haml b/app/views/projects/merge_requests/update_branches.js.haml
index 6a21551e811..ca21b3bc0de 100644
--- a/app/views/projects/merge_requests/update_branches.js.haml
+++ b/app/views/projects/merge_requests/update_branches.js.haml
@@ -1,5 +1,9 @@
 :plain
   $(".target_branch").html("#{escape_javascript(options_for_select(@target_branches))}");
-  $(".target_branch").trigger("select2:updated");
+
+  $('select.target_branch').select2({
+    width: 'resolve',
+    dropdownAutoWidth: true
+  });
+
   $(".mr_target_commit").html("");
-  $(".target_branch").trigger("change");
-- 
GitLab


From 6f6f1588ba5123f156ee3b0635a061745b71fcde Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Thu, 23 Jan 2014 10:13:23 +0200
Subject: [PATCH 2/6] Version 6.5.1

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
---
 CHANGELOG | 3 +++
 VERSION   | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 981fd0e77ab..2e5cd78c8a8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+v 6.5.1
+  - Fix branch selectbox when create merge request from fork
+
 v 6.5.0
   - Dropdown menus on issue#show page for assignee and milestone (Jason Blanchard)
   - Add color custimization and previewing to broadcast messages
diff --git a/VERSION b/VERSION
index f22d756da39..a194c18e86e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-6.5.0
+6.5.1
-- 
GitLab


From 57662ccc6a844bae4fe41043d4578cc6dd5d0208 Mon Sep 17 00:00:00 2001
From: Jens Neuhalfen <jens@neuhalfen.name>
Date: Sun, 19 Jan 2014 21:39:37 +0100
Subject: [PATCH 3/6] init.d script: fallback in case $USER is not set.

---
 lib/support/init.d/gitlab | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/support/init.d/gitlab b/lib/support/init.d/gitlab
index cb2db44c97c..58ac0292f2c 100755
--- a/lib/support/init.d/gitlab
+++ b/lib/support/init.d/gitlab
@@ -39,6 +39,11 @@ sidekiq_pid_path="$pid_path/sidekiq.pid"
 # Read configuration variable file if it is present
 test -f /etc/default/gitlab && . /etc/default/gitlab
 
+# Not all systems set $USER
+if [ "x$USER" == "x" ]; then
+  USER=$(id -nu)
+fi
+
 # Switch to the app_user if it is not he/she who is running the script.
 if [ "$USER" != "$app_user" ]; then
   sudo -u "$app_user" -H -i $0 "$@"; exit;
-- 
GitLab


From 8c16f5671d7f18d17172c046aeb5ef269b6b73bc Mon Sep 17 00:00:00 2001
From: Jens Neuhalfen <jens@neuhalfen.name>
Date: Sun, 19 Jan 2014 22:13:08 +0100
Subject: [PATCH 4/6] init.d script: 'ps -0'  to test for a running process
 with a given pid is not supported on all systems (e.g. Solaris, illumos).
 Replace with 'ps -p', which works on more systems.

Tested on SmartOS (illumos), Mac OS X Maverick (10.9.1), and Ubuntu 12.04.4 LTS
---
 lib/support/init.d/gitlab | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/support/init.d/gitlab b/lib/support/init.d/gitlab
index 58ac0292f2c..da106f002c2 100755
--- a/lib/support/init.d/gitlab
+++ b/lib/support/init.d/gitlab
@@ -104,13 +104,13 @@ check_status(){
   # If the web server is running kill -0 $wpid returns true, or rather 0.
   # Checks of *_status should only check for == 0 or != 0, never anything else.
   if [ $wpid -ne 0 ]; then
-    kill -0 "$wpid" 2>/dev/null
+    ps  -p "$wpid" 2>&1 1>/dev/null
     web_status="$?"
   else
     web_status="-1"
   fi
   if [ $spid -ne 0 ]; then
-    kill -0 "$spid" 2>/dev/null
+    ps  -p "$spid" 2>&1 1>/dev/null
     sidekiq_status="$?"
   else
     sidekiq_status="-1"
-- 
GitLab


From 7f443251b4bfb353a58b398dab9b2494b3624715 Mon Sep 17 00:00:00 2001
From: Jens Neuhalfen <jens@neuhalfen.name>
Date: Sun, 19 Jan 2014 22:40:20 +0100
Subject: [PATCH 5/6] Some systems, e.g. Illumos, have an alias for 'stop' in
 /bin/sh that prevents the call to the stop function in the script. Fixed by
 calling '\stop' instead of 'stop'.

---
 lib/support/init.d/gitlab | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/support/init.d/gitlab b/lib/support/init.d/gitlab
index da106f002c2..bedd8cfcb39 100755
--- a/lib/support/init.d/gitlab
+++ b/lib/support/init.d/gitlab
@@ -101,7 +101,7 @@ check_pids
 ## Checks whether the different parts of the service are already running or not.
 check_status(){
   check_pids
-  # If the web server is running kill -0 $wpid returns true, or rather 0.
+  # If the web server is running ps -p $wpid returns true, or rather 0.
   # Checks of *_status should only check for == 0 or != 0, never anything else.
   if [ $wpid -ne 0 ]; then
     ps  -p "$wpid" 2>&1 1>/dev/null
@@ -285,7 +285,8 @@ case "$1" in
         start
         ;;
   stop)
-        stop
+        # Some systems, e.g. Illumos have an alias for stop in /bin/sh that prevents the call to the stop function
+        \stop
         ;;
   restart)
         restart
-- 
GitLab


From 0a2eb18d03a5ccbcdb453ffbfd418bfbc0303ff3 Mon Sep 17 00:00:00 2001
From: Jens Neuhalfen <jens@neuhalfen.name>
Date: Mon, 20 Jan 2014 08:10:09 +0100
Subject: [PATCH 6/6] init.d: use corrct equals operator for POSIX shell (=)

---
 lib/support/init.d/gitlab | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/support/init.d/gitlab b/lib/support/init.d/gitlab
index bedd8cfcb39..5e4314bdec0 100755
--- a/lib/support/init.d/gitlab
+++ b/lib/support/init.d/gitlab
@@ -40,7 +40,7 @@ sidekiq_pid_path="$pid_path/sidekiq.pid"
 test -f /etc/default/gitlab && . /etc/default/gitlab
 
 # Not all systems set $USER
-if [ "x$USER" == "x" ]; then
+if [ "x$USER" = "x" ]; then
   USER=$(id -nu)
 fi
 
-- 
GitLab