diff -Nru gitlab-8.13.11+dfsg/debian/changelog gitlab-8.13.11+dfsg/debian/changelog
--- gitlab-8.13.11+dfsg/debian/changelog	2017-01-18 13:21:17.000000000 +0530
+++ gitlab-8.13.11+dfsg/debian/changelog	2017-02-07 11:24:36.000000000 +0530
@@ -1,3 +1,11 @@
+gitlab (8.13.11+dfsg-2) unstable; urgency=medium
+
+  * Use upstream patch for git 2.11 support (Closes: #853251)
+  * Set minimum version of gitlab-shell to 3.6.6-3
+    (required for git 2.11 support) 
+
+ -- Pirate Praveen <praveen@debian.org>  Tue, 07 Feb 2017 11:24:36 +0530
+
 gitlab (8.13.11+dfsg-1) unstable; urgency=medium
 
   * New upstream release
diff -Nru gitlab-8.13.11+dfsg/debian/control gitlab-8.13.11+dfsg/debian/control
--- gitlab-8.13.11+dfsg/debian/control	2017-01-18 13:21:17.000000000 +0530
+++ gitlab-8.13.11+dfsg/debian/control	2017-02-07 11:24:36.000000000 +0530
@@ -3,7 +3,8 @@
 Priority: optional
 Maintainer: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers@lists.alioth.debian.org>
 Uploaders: Cédric Boutillier <boutil@debian.org>,
- Pirate Praveen <praveen@debian.org>
+ Pirate Praveen <praveen@debian.org>,
+ Balasankar C <balasankarc@autistici.org>
 Build-Depends: debhelper (>= 9~), gem2deb, dh-systemd, bc, node-uglify
 Standards-Version: 3.9.8
 Vcs-Git: https://anonscm.debian.org/git/pkg-ruby-extras/gitlab.git
@@ -30,7 +31,7 @@
  postfix | exim4 | mail-transport-agent,
  openssh-client,
  ucf,
- gitlab-shell (>= 3.6.6-2~),
+ gitlab-shell (>= 3.6.6-3~),
  gitlab-workhorse (>= 0.8.5~),
  ruby-rails (>= 2:4.2.7~),
  ruby-rails (<< 2:5),
diff -Nru gitlab-8.13.11+dfsg/debian/gitlab.lintian-overrides gitlab-8.13.11+dfsg/debian/gitlab.lintian-overrides
--- gitlab-8.13.11+dfsg/debian/gitlab.lintian-overrides	2017-01-18 13:21:17.000000000 +0530
+++ gitlab-8.13.11+dfsg/debian/gitlab.lintian-overrides	2017-02-07 11:24:36.000000000 +0530
@@ -28,5 +28,8 @@
 
 # libjs-cropper is 1.2.2, embedded cropper.js is 2.3.0 and a different upstream 
 embedded-javascript-library usr/share/gitlab/app/assets/javascripts/lib/cropper.js please use libjs-cropper
+# This is not the raphael library
+embedded-javascript-library usr/share/gitlab/app/assets/javascripts/lib/raphael.js please use libjs-raphael
 # This is not the jquery library
+embedded-javascript-library usr/share/gitlab/app/assets/javascripts/extensions/jquery.js please use libjs-jquery
 embedded-javascript-library usr/share/gitlab/vendor/assets/javascripts/extensions/jquery.js please use libjs-jquery
diff -Nru gitlab-8.13.11+dfsg/debian/patches/0210-use-jquery-ui-rails6.patch gitlab-8.13.11+dfsg/debian/patches/0210-use-jquery-ui-rails6.patch
--- gitlab-8.13.11+dfsg/debian/patches/0210-use-jquery-ui-rails6.patch	2017-01-18 13:21:17.000000000 +0530
+++ gitlab-8.13.11+dfsg/debian/patches/0210-use-jquery-ui-rails6.patch	2017-02-07 11:24:36.000000000 +0530
@@ -1,3 +1,5 @@
+adapt gitlab to use jquery-ui 6 directory structure
+
 --- a/Gemfile
 +++ b/Gemfile
 @@ -224,7 +224,7 @@
diff -Nru gitlab-8.13.11+dfsg/debian/patches/0300-git-2-11-support.patch gitlab-8.13.11+dfsg/debian/patches/0300-git-2-11-support.patch
--- gitlab-8.13.11+dfsg/debian/patches/0300-git-2-11-support.patch	2017-01-18 13:21:17.000000000 +0530
+++ gitlab-8.13.11+dfsg/debian/patches/0300-git-2-11-support.patch	2017-02-07 11:24:36.000000000 +0530
@@ -1,27 +1,81 @@
-From 8f3edeb7d50e8e8176627f668cda489935eccdf3 Mon Sep 17 00:00:00 2001
+From daf83fa62c940b0da7dc4e0893586b6a9a2dbbf9 Mon Sep 17 00:00:00 2001
 From: Douglas Barbosa Alexandre <dbalexandre@gmail.com>
 Date: Mon, 19 Dec 2016 09:37:16 +0000
-Subject: [PATCH] Merge branch '25301-git-2.11-force-push-bug' into 'master' Accept environment variables from the `pre-receive` script ## Summary 1. Starting version 2.11, git changed the way the pre-receive flow works. - Previously, the new potential objects would be added to the main repo. If the pre-receive passes, the new objects stay in the repo but are linked up. If the pre-receive fails, the new objects stay orphaned in the repo, and are cleaned up during the next `git gc`. - In 2.11, the new potential objects are added to a temporary "alternate object directory", that git creates for this purpose. If the pre-receive passes, the objects from the alternate object directory are migrated to the main repo. If the pre-receive fails the alternate object directory is simply deleted. 2. In our workflow, the pre-recieve script (in `gitlab-shell`) calls the `/allowed` endpoint, which calls out directly to git to perform various checks. These direct calls to git do _not_ have the necessary environment variables set which allow access to the "alternate object directory" (explained above). Therefore these calls to git are not able to access any of the new potential objects to be added during this push. 3. We fix this by accepting the relevant environment variables (`GIT_ALTERNATE_OBJECT_DIRECTORIES`, `GIT_OBJECT_DIRECTORY`, and `GIT_QUARANTINE_PATH`) on the `/allowed` endpoint, and then include these environment variables while calling out to git. 4. This commit includes these environment variables while making the "force push" check. ## Issue Numbers - Closes #25301 (assuming the corresponding `gitlab-shell` MR has been merged in first) - Corresponding `gitlab-shell` MR: gitlab-org/gitlab-shell!112 - Corresponding EE MR: gitlab-org/gitlab-ee!964 ## Tasks -  [#25301/!7967/!112] Git version 2.11.0 - Can't push to protected branch as master or developer - [x]  Investigate - [x]  Implementation - [x]  `force_push.rb` should use the relevant environment variables - [x]  Any other instances of `/allowed` calling out to git directly? - [x]  Verify that the fix works over SSH as well - [x]  Can we trim the number of env variables? Do we need all 3? - [x]  Whitelist variables. Server shouldn't pass through _any_ env variable passed in - [x]  Any security implications? - [x]  Check for force push return code - [x]  Shouldn't be able to opt-out from the force push check by passing an env variable - [x]  Tests - [x]  CE - [x]  Added - [x]  Passing - [x]  Shell - [x]  Added - [x]  Passing - [x]  Meta - [x]  CHANGELOG entry created - [x]  Branch has no merge conflicts with `master` - [x]  Squashed related commits together - [x]  EE merge request - [x]  Review - [x]  Endboss - [ ]  Follow-up - [x]  Make sure EE is working as expected - [x]  [CE] Gitlab changes without gitlab-shell changes shouldn't raise any exceptions - [x]  [CE] Gitlab-shell changes without gitlab changes shouldn't raise any exceptions - [x]  [EE] Gitlab changes without gitlab-shell changes shouldn't raise any exceptions - [x]  [EE] Gitlab-shell changes without gitlab changes shouldn't raise any exceptions - [ ]  Wait for merge - [ ]  CE - [ ]  EE - [x]  Shell See merge request !7967
+Subject: [PATCH 1/3] [8.13 Backport] Merge branch
+ '25301-git-2.11-force-push-bug' into 'master'
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
 
+Accept environment variables from the `pre-receive` script
+
+1. Starting version 2.11, git changed the way the pre-receive flow works.
+  - Previously, the new potential objects would be added to the main repo. If the pre-receive passes, the new objects stay in the repo but are linked up. If the pre-receive fails, the new objects stay orphaned in the repo, and are cleaned up during the next `git gc`.
+  - In 2.11, the new potential objects are added to a temporary "alternate object directory", that git creates for this purpose. If the pre-receive passes, the objects from the alternate object directory are migrated to the main repo. If the pre-receive fails the alternate object directory is simply deleted.
+2. In our workflow, the pre-recieve script (in `gitlab-shell`) calls the
+   `/allowed` endpoint, which calls out directly to git to perform
+   various checks. These direct calls to git do _not_ have the necessary
+   environment variables set which allow access to the "alternate object
+   directory" (explained above). Therefore these calls to git are not able to
+   access any of the new potential objects to be added during this push.
+
+3. We fix this by accepting the relevant environment variables
+   (`GIT_ALTERNATE_OBJECT_DIRECTORIES`, `GIT_OBJECT_DIRECTORY`, and
+   `GIT_QUARANTINE_PATH`) on the `/allowed` endpoint, and then include
+   these environment variables while calling out to git.
+
+4. This commit includes these environment variables while making the "force
+   push" check.
+
+See https://gitlab.com/gitlab-org/gitlab-shell/merge_requests/120
+
+Signed-off-by: Rémy Coutable <remy@rymai.me>
 ---
- lib/api/helpers/internal_helpers.rb                     |  8 ++++++++
- lib/api/internal.rb                                     |  6 +++++-
- lib/gitlab/checks/change_access.rb                      |  5 +++--
- lib/gitlab/checks/force_push.rb                         | 11 ++++++++---
- lib/gitlab/git/rev_list.rb                              | 42 ++++++++++++++++++++++++++++++++++++++++++
- lib/gitlab/git_access.rb                                |  5 +++--
- lib/gitlab/popen.rb                                     |  4 ++--
- spec/lib/gitlab/checks/force_push_spec.rb               | 19 +++++++++++++++++++
- spec/lib/gitlab/git/rev_list_spec.rb                    | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
- 10 files changed, 147 insertions(+), 10 deletions(-)
+ .../unreleased/25301-git-2-11-force-push-bug.yml   |  4 ++
+ lib/api/internal.rb                                | 14 +++++-
+ lib/gitlab/checks/change_access.rb                 |  5 +-
+ lib/gitlab/checks/force_push.rb                    | 11 +++--
+ lib/gitlab/git/rev_list.rb                         | 42 +++++++++++++++++
+ lib/gitlab/git_access.rb                           |  5 +-
+ lib/gitlab/popen.rb                                |  4 +-
+ spec/lib/gitlab/checks/force_push_spec.rb          | 19 ++++++++
+ spec/lib/gitlab/git/rev_list_spec.rb               | 53 ++++++++++++++++++++++
+ 9 files changed, 147 insertions(+), 10 deletions(-)
  create mode 100644 changelogs/unreleased/25301-git-2-11-force-push-bug.yml
  create mode 100644 lib/gitlab/git/rev_list.rb
  create mode 100644 spec/lib/gitlab/checks/force_push_spec.rb
  create mode 100644 spec/lib/gitlab/git/rev_list_spec.rb
 
+diff --git a/changelogs/unreleased/25301-git-2-11-force-push-bug.yml b/changelogs/unreleased/25301-git-2-11-force-push-bug.yml
+new file mode 100644
+index 0000000..afe5772
+--- /dev/null
++++ b/changelogs/unreleased/25301-git-2-11-force-push-bug.yml
+@@ -0,0 +1,4 @@
++---
++title: Accept environment variables from the `pre-receive` script
++merge_request: 7967
++author: 
+diff --git a/lib/api/internal.rb b/lib/api/internal.rb
+index 9a5d1ec..89e47a7 100644
 --- a/lib/api/internal.rb
 +++ b/lib/api/internal.rb
-@@ -61,7 +61,11 @@
+@@ -43,6 +43,14 @@ module API
+             :push_code
+           ]
+         end
++
++        def parse_allowed_environment_variables
++          return if params[:env].blank?
++
++          JSON.parse(params[:env])
++
++        rescue JSON::ParserError
++        end
+       end
+ 
+       post "/allowed" do
+@@ -61,7 +69,11 @@ module API
            if wiki?
              Gitlab::GitAccessWiki.new(actor, project, protocol, authentication_abilities: ssh_authentication_abilities)
            else
@@ -34,9 +88,11 @@
            end
  
          access_status = access.check(params[:action], params[:changes])
+diff --git a/lib/gitlab/checks/change_access.rb b/lib/gitlab/checks/change_access.rb
+index cb10652..3d20301 100644
 --- a/lib/gitlab/checks/change_access.rb
 +++ b/lib/gitlab/checks/change_access.rb
-@@ -3,11 +3,12 @@
+@@ -3,11 +3,12 @@ module Gitlab
      class ChangeAccess
        attr_reader :user_access, :project
  
@@ -50,7 +106,7 @@
        end
  
        def exec
-@@ -68,7 +69,7 @@
+@@ -68,7 +69,7 @@ module Gitlab
        end
  
        def forced_push?
@@ -59,6 +115,8 @@
        end
  
        def matching_merge_request?
+diff --git a/lib/gitlab/checks/force_push.rb b/lib/gitlab/checks/force_push.rb
+index 5fe8655..de0c904 100644
 --- a/lib/gitlab/checks/force_push.rb
 +++ b/lib/gitlab/checks/force_push.rb
 @@ -1,15 +1,20 @@
@@ -85,6 +143,9 @@
          end
        end
      end
+diff --git a/lib/gitlab/git/rev_list.rb b/lib/gitlab/git/rev_list.rb
+new file mode 100644
+index 0000000..25e9d61
 --- /dev/null
 +++ b/lib/gitlab/git/rev_list.rb
 @@ -0,0 +1,42 @@
@@ -130,9 +191,11 @@
 +    end
 +  end
 +end
+diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
+index bcbf645..74e8713 100644
 --- a/lib/gitlab/git_access.rb
 +++ b/lib/gitlab/git_access.rb
-@@ -17,12 +17,13 @@
+@@ -17,12 +17,13 @@ module Gitlab
  
      attr_reader :actor, :project, :protocol, :user_access, :authentication_abilities
  
@@ -147,7 +210,7 @@
      end
  
      def check(cmd, changes)
-@@ -99,7 +100,7 @@
+@@ -99,7 +100,7 @@ module Gitlab
      end
  
      def change_access_check(change)
@@ -156,9 +219,11 @@
      end
  
      def protocol_allowed?
+diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb
+index cc74bb2..4bc5cda 100644
 --- a/lib/gitlab/popen.rb
 +++ b/lib/gitlab/popen.rb
-@@ -5,13 +5,13 @@
+@@ -5,13 +5,13 @@ module Gitlab
    module Popen
      extend self
  
@@ -174,6 +239,9 @@
        options = { chdir: path }
  
        unless File.directory?(path)
+diff --git a/spec/lib/gitlab/checks/force_push_spec.rb b/spec/lib/gitlab/checks/force_push_spec.rb
+new file mode 100644
+index 0000000..f628801
 --- /dev/null
 +++ b/spec/lib/gitlab/checks/force_push_spec.rb
 @@ -0,0 +1,19 @@
@@ -196,6 +264,9 @@
 +    end
 +  end
 +end
+diff --git a/spec/lib/gitlab/git/rev_list_spec.rb b/spec/lib/gitlab/git/rev_list_spec.rb
+new file mode 100644
+index 0000000..444639a
 --- /dev/null
 +++ b/spec/lib/gitlab/git/rev_list_spec.rb
 @@ -0,0 +1,53 @@
@@ -252,3 +323,116 @@
 +    end
 +  end
 +end
+-- 
+2.10.2
+
+
+From 0ce20138298eaebfb9e8225d21e7b0088716e5ad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?R=C3=A9my=20Coutable?= <remy@rymai.me>
+Date: Tue, 20 Dec 2016 09:45:37 +0100
+Subject: [PATCH 2/3] Reject blank environment vcariables in
+ Gitlab::Git::RevList
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Rémy Coutable <remy@rymai.me>
+---
+ lib/gitlab/git/rev_list.rb           | 4 ++--
+ spec/lib/gitlab/git/rev_list_spec.rb | 7 +++++++
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/lib/gitlab/git/rev_list.rb b/lib/gitlab/git/rev_list.rb
+index 25e9d61..79dd0cf 100644
+--- a/lib/gitlab/git/rev_list.rb
++++ b/lib/gitlab/git/rev_list.rb
+@@ -22,7 +22,7 @@ module Gitlab
+ 
+       def valid?
+         environment_variables.all? do |(name, value)|
+-          value.start_with?(project.repository.path_to_repo)
++          value.to_s.start_with?(project.repository.path_to_repo)
+         end
+       end
+ 
+@@ -35,7 +35,7 @@ module Gitlab
+       end
+ 
+       def environment_variables
+-        @environment_variables ||= env.slice(*ALLOWED_VARIABLES)
++        @environment_variables ||= env.slice(*ALLOWED_VARIABLES).compact
+       end
+     end
+   end
+diff --git a/spec/lib/gitlab/git/rev_list_spec.rb b/spec/lib/gitlab/git/rev_list_spec.rb
+index 444639a..1f9c987 100644
+--- a/spec/lib/gitlab/git/rev_list_spec.rb
++++ b/spec/lib/gitlab/git/rev_list_spec.rb
+@@ -26,6 +26,13 @@ describe Gitlab::Git::RevList, lib: true do
+ 
+           expect(rev_list).not_to be_valid
+         end
++
++        it "ignores nil values" do
++          env = { var => nil }
++          rev_list = described_class.new('oldrev', 'newrev', project: project, env: env)
++
++          expect(rev_list).to be_valid
++        end
+       end
+     end
+   end
+-- 
+2.10.2
+
+
+From b54b031638e7a98c1e51b369cff53602db40e4b0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?R=C3=A9my=20Coutable?= <remy@rymai.me>
+Date: Mon, 6 Feb 2017 10:04:21 +0100
+Subject: [PATCH 3/3] Update gitlab-shell to 3.6.7
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Rémy Coutable <remy@rymai.me>
+---
+ changelogs/unreleased/use-gitlab-shell-3-6-7.yml | 4 ++++
+ doc/update/8.12-to-8.13.md                       | 4 ++--
+ 3 files changed, 7 insertions(+), 3 deletions(-)
+ create mode 100644 changelogs/unreleased/use-gitlab-shell-3-6-7.yml
+
+diff --git a/changelogs/unreleased/use-gitlab-shell-3-6-7.yml b/changelogs/unreleased/use-gitlab-shell-3-6-7.yml
+new file mode 100644
+index 0000000..c6600ce
+--- /dev/null
++++ b/changelogs/unreleased/use-gitlab-shell-3-6-7.yml
+@@ -0,0 +1,4 @@
++---
++title: Use gitlab-shell v3.6.7
++merge_request:
++author:
+diff --git a/doc/update/8.12-to-8.13.md b/doc/update/8.12-to-8.13.md
+index c0084d9..6457ec9 100644
+--- a/doc/update/8.12-to-8.13.md
++++ b/doc/update/8.12-to-8.13.md
+@@ -72,7 +72,7 @@ sudo -u git -H git checkout 8-13-stable-ee
+ ```bash
+ cd /home/git/gitlab-shell
+ sudo -u git -H git fetch --all --tags
+-sudo -u git -H git checkout v3.6.6
++sudo -u git -H git checkout v3.6.7
+ ```
+ 
+ ### 6. Update gitlab-workhorse
+@@ -166,7 +166,7 @@ See [smtp_settings.rb.sample] as an example.
+ Ensure you're still up-to-date with the latest init script changes:
+ 
+     sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
+-    
++
+ For Ubuntu 16.04.1 LTS:
+ 
+     sudo systemctl daemon-reload
+-- 
+2.10.2
+
diff -Nru gitlab-8.13.11+dfsg/debian/source/lintian-overrides gitlab-8.13.11+dfsg/debian/source/lintian-overrides
--- gitlab-8.13.11+dfsg/debian/source/lintian-overrides	2017-01-18 13:21:17.000000000 +0530
+++ gitlab-8.13.11+dfsg/debian/source/lintian-overrides	2017-02-07 11:24:36.000000000 +0530
@@ -4,7 +4,6 @@
 
 # False positive  
 gitlab source: source-is-missing vendor/assets/javascripts/fuzzaldrin-plus.js line length is 480 characters (>256)
-gitlab source: source-is-missing app/assets/javascripts/issuable.js line length is 598 characters (>512)
 gitlab source: source-is-missing app/assets/javascripts/labels_select.js line length is 409 characters (>256)
 gitlab source: source-is-missing app/assets/javascripts/shortcuts_blob.js line length is 289 characters (>256)
 gitlab source: source-is-missing app/assets/javascripts/shortcuts_dashboard_navigation.js line length is 289 characters (>256)
@@ -13,8 +12,6 @@
 gitlab source: source-is-missing app/assets/javascripts/shortcuts_navigation.js line length is 289 characters (>256)
 gitlab source: source-is-missing app/assets/javascripts/shortcuts_network.js line length is 289 characters (>256)
 gitlab source: source-is-missing spec/javascripts/fixtures/emoji_menu.js line length is 32752 characters (>512)
-gitlab source: source-is-missing app/assets/javascripts/blob/blob_ci_yaml.js line length is 289 characters (>256)
 gitlab source: source-is-missing app/assets/javascripts/blob/blob_gitignore_selector.js line length is 289 characters (>256)
 gitlab source: source-is-missing app/assets/javascripts/blob/blob_license_selector.js line length is 289 characters (>256)
 gitlab source: source-is-missing app/assets/javascripts/graphs/stat_graph_contributors_graph.js line length is 287 characters (>256)
-gitlab source: source-is-missing app/assets/javascripts/profile/gl_crop.js line length is 575 characters (>512)
