summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Ramsay <james@jramsay.com.au>2018-02-19 15:41:04 -0500
committerJames Ramsay <james@jramsay.com.au>2018-04-06 08:45:17 -0400
commit07f517d441ab8782286b4a59d56a630393d75e16 (patch)
treed388461feb28fbed2b5c6f52303c7eb7b0f633e3 /lib
parent0b1b9c409d3adbf4517351dbb9037ed053f73e67 (diff)
downloadgitlab-ce-07f517d441ab8782286b4a59d56a630393d75e16.tar.gz
Add new repository archive route
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 `<project>/-/archive/<ref>/<filename>.<format>` route using the `-` separator to prevent namespace collisions. If the filename is `<project>-<ref>` or the ref is a sha, the sha will be omitted, otherwise the default filename will be used. - deprecate previous archive route `repository/<ref>/archive`
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/git/repository.rb2
-rw-r--r--lib/gitlab/workhorse.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index a928a05f03f..aedefbd0a41 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -406,7 +406,7 @@ module Gitlab
prefix_segments.join('-')
end
- def archive_metadata(ref, storage_path, format = "tar.gz", append_sha: true)
+ def archive_metadata(ref, storage_path, format = "tar.gz", append_sha:)
ref ||= root_ref
commit = Gitlab::Git::Commit.find(self, ref)
return {} if commit.nil?
diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb
index bdb20060cc0..91b469d9bc5 100644
--- a/lib/gitlab/workhorse.rb
+++ b/lib/gitlab/workhorse.rb
@@ -63,10 +63,10 @@ module Gitlab
]
end
- def send_git_archive(repository, ref:, format:, append_sha: true)
+ def send_git_archive(repository, ref:, format:, append_sha:)
format ||= 'tar.gz'
format.downcase!
- params = repository.archive_metadata(ref, Gitlab.config.gitlab.repository_downloads_path, format, append_sha)
+ params = repository.archive_metadata(ref, Gitlab.config.gitlab.repository_downloads_path, format, append_sha: append_sha)
raise "Repository or ref not found" if params.empty?
if Gitlab::GitalyClient.feature_enabled?(:workhorse_archive, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT)