diff options
author | Nick Thomas <nick@gitlab.com> | 2016-09-20 17:21:52 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-09-22 18:49:31 +0100 |
commit | a8829f25d3c2de4b7ca17c83f80bdd2907cf5f9a (patch) | |
tree | 733f4e128ecb9760694b23acd48d5a1ca943c1ca /lib | |
parent | 422c90251d9dbe42d5a8c852124398d1beae9176 (diff) | |
download | gitlab-ce-a8829f25d3c2de4b7ca17c83f80bdd2907cf5f9a.tar.gz |
Use base SHA for patches and diffs
This commit changes the revisions used for diffs. The current behaviour is
to show all changes between current tip of master and tip of the MR, rather
than matching the output of the web frontend (which just shows the changes
in the MR). Switching from start_sha to base_sha fixes this.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/workhorse.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb index 60aae541d46..5d33f98e89e 100644 --- a/lib/gitlab/workhorse.rb +++ b/lib/gitlab/workhorse.rb @@ -60,7 +60,7 @@ module Gitlab def send_git_diff(repository, diff_refs) params = { 'RepoPath' => repository.path_to_repo, - 'ShaFrom' => diff_refs.start_sha, + 'ShaFrom' => diff_refs.base_sha, 'ShaTo' => diff_refs.head_sha } @@ -73,7 +73,7 @@ module Gitlab def send_git_patch(repository, diff_refs) params = { 'RepoPath' => repository.path_to_repo, - 'ShaFrom' => diff_refs.start_sha, + 'ShaFrom' => diff_refs.base_sha, 'ShaTo' => diff_refs.head_sha } @@ -107,15 +107,15 @@ module Gitlab bytes end end - + def write_secret bytes = SecureRandom.random_bytes(SECRET_LENGTH) - File.open(secret_path, 'w:BINARY', 0600) do |f| + File.open(secret_path, 'w:BINARY', 0600) do |f| f.chmod(0600) f.write(Base64.strict_encode64(bytes)) end end - + def verify_api_request!(request_headers) JWT.decode( request_headers[INTERNAL_API_REQUEST_HEADER], @@ -128,7 +128,7 @@ module Gitlab def secret_path Rails.root.join('.gitlab_workhorse_secret') end - + protected def encode(hash) |