Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-09-25 13:30:37 +0300
committerRobert Speicher <robert@gitlab.com>2016-09-25 13:30:37 +0300
commit0a9f9c10e466fdc711463eefbb80bd856c98c1e3 (patch)
tree7caf4fe7c39c018591171fe61c58a8fc96c94f78 /lib
parentb12dedc072b56d1addfa8a8df40a82145e19f75b (diff)
parenta8829f25d3c2de4b7ca17c83f80bdd2907cf5f9a (diff)
Merge branch '22229-use-base-sha-when-downloading-merge-requests' into 'master'
Use base SHA for patches and diffs ## What does this MR do? Switch from using 'start SHA' to 'base SHA' for patches and diffs ## Are there points in the code the reviewer needs to double check? ## Why was this MR needed? Makes the downloaded patches and diffs on the merge request page match the frontend-rendered "changes" in these scenarios: * Unpatched gitlab-workhorse, downloading patchsets of open MRs (https://gitlab.com/gitlab-org/gitlab-workhorse/merge_requests/68) * Unpatched gitlab-workhorse, downloading diffs of open and merged MRs * Patched gitlab-workhorse, downloading patchsets of merged merge requests ## What are the relevant issue numbers? Closes #22229 See merge request !6435
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/workhorse.rb12
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)