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/api
diff options
context:
space:
mode:
authorJames Ramsay <james@jramsay.com.au>2018-02-19 23:41:04 +0300
committerJames Ramsay <james@jramsay.com.au>2018-04-04 23:56:18 +0300
commit0b1b9c409d3adbf4517351dbb9037ed053f73e67 (patch)
tree2a8b6e8c3efe9f5ffbab63b80e8871ebf84ff6da /lib/api
parenteaed588bf228c833cb666a61bc7d25cf21d5f94b (diff)
Add option to suppress archive commit sha
Repository archives are always named `<project>-<ref>-<sha>` even if the ref is a commit. A consequence of always including the sha even for tags is that packaging a release is more difficult because both the ref and sha must be known by the packager. - add append_sha option (defaults true) to provide a method for toggling this feature. Support added to GitLab Workhorse by gitlab-org/gitlab-workhorse!232
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/helpers.rb4
-rw-r--r--lib/api/repositories.rb2
-rw-r--r--lib/api/v3/repositories.rb2
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index e59e8a45908..e22d32e4c1b 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -489,8 +489,8 @@ module API
header(*Gitlab::Workhorse.send_git_blob(repository, blob))
end
- def send_git_archive(repository, ref:, format:)
- header(*Gitlab::Workhorse.send_git_archive(repository, ref: ref, format: format))
+ def send_git_archive(repository, **kwargs)
+ header(*Gitlab::Workhorse.send_git_archive(repository, **kwargs))
end
def send_artifacts_entry(build, entry)
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb
index 9638c53a1df..2396dc73f0e 100644
--- a/lib/api/repositories.rb
+++ b/lib/api/repositories.rb
@@ -88,7 +88,7 @@ module API
end
get ':id/repository/archive', requirements: { format: Gitlab::PathRegex.archive_formats_regex } do
begin
- send_git_archive user_project.repository, ref: params[:sha], format: params[:format]
+ send_git_archive user_project.repository, ref: params[:sha], format: params[:format], append_sha: true
rescue
not_found!('File')
end
diff --git a/lib/api/v3/repositories.rb b/lib/api/v3/repositories.rb
index 5b54734bb45..f701d64e886 100644
--- a/lib/api/v3/repositories.rb
+++ b/lib/api/v3/repositories.rb
@@ -75,7 +75,7 @@ module API
end
get ':id/repository/archive', requirements: { format: Gitlab::PathRegex.archive_formats_regex } do
begin
- send_git_archive user_project.repository, ref: params[:sha], format: params[:format]
+ send_git_archive user_project.repository, ref: params[:sha], format: params[:format], append_sha: true
rescue
not_found!('File')
end