diff options
author | James Ramsay <james@jramsay.com.au> | 2018-02-19 15:41:04 -0500 |
---|---|---|
committer | James Ramsay <james@jramsay.com.au> | 2018-04-04 16:56:18 -0400 |
commit | 0b1b9c409d3adbf4517351dbb9037ed053f73e67 (patch) | |
tree | 2a8b6e8c3efe9f5ffbab63b80e8871ebf84ff6da /spec | |
parent | eaed588bf228c833cb666a61bc7d25cf21d5f94b (diff) | |
download | gitlab-ce-0b1b9c409d3adbf4517351dbb9037ed053f73e67.tar.gz |
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 'spec')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 5cbe2808d0b..2bb8aa69def 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -247,16 +247,22 @@ describe Gitlab::Git::Repository, seed_helper: true do end it 'returns parameterised string for a ref containing slashes' do - prefix = repository.archive_prefix('test/branch', 'SHA') + prefix = repository.archive_prefix('test/branch', 'SHA', append_sha: true) expect(prefix).to eq("#{project_name}-test-branch-SHA") end it 'returns correct string for a ref containing dots' do - prefix = repository.archive_prefix('test.branch', 'SHA') + prefix = repository.archive_prefix('test.branch', 'SHA', append_sha: true) expect(prefix).to eq("#{project_name}-test.branch-SHA") end + + it 'returns string with sha when append_sha is false' do + prefix = repository.archive_prefix('test.branch', 'SHA', append_sha: false) + + expect(prefix).to eq("#{project_name}-test.branch") + end end describe '#archive' do |