summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-09-06 12:36:19 +0000
committerRémy Coutable <remy@rymai.me>2018-09-06 12:36:19 +0000
commit55b5264043bdecbbb5971c55c27ccbbeb0eb041e (patch)
treee327496ee6c5a45480625a4ccb78c6e59c39ad32
parent4a14ff5bcefe170d3f3ff9885fff21500442fac6 (diff)
parent643c6f31e5f0ad4ba7b5ff1b9c3d1af2dc93cd57 (diff)
downloadgitlab-ce-55b5264043bdecbbb5971c55c27ccbbeb0eb041e.tar.gz
Merge branch 'feature/recognize-unlicense' into 'master'
Recognize 'UNLICENSE' license files See merge request gitlab-org/gitlab-ce!21508
-rw-r--r--changelogs/unreleased/47440-recognize-unlicense-license-file.yml5
-rw-r--r--lib/gitlab/file_detector.rb2
-rw-r--r--spec/lib/gitlab/file_detector_spec.rb6
3 files changed, 11 insertions, 2 deletions
diff --git a/changelogs/unreleased/47440-recognize-unlicense-license-file.yml b/changelogs/unreleased/47440-recognize-unlicense-license-file.yml
new file mode 100644
index 00000000000..3521dd613b0
--- /dev/null
+++ b/changelogs/unreleased/47440-recognize-unlicense-license-file.yml
@@ -0,0 +1,5 @@
+---
+title: Recognize 'UNLICENSE' license files
+merge_request: 21508
+author: J.D. Bean
+type: added
diff --git a/lib/gitlab/file_detector.rb b/lib/gitlab/file_detector.rb
index 49bc9c0b671..8f55e94975c 100644
--- a/lib/gitlab/file_detector.rb
+++ b/lib/gitlab/file_detector.rb
@@ -8,7 +8,7 @@ module Gitlab
# Project files
readme: %r{\Areadme[^/]*\z}i,
changelog: %r{\A(changelog|history|changes|news)[^/]*\z}i,
- license: %r{\A(licen[sc]e|copying)(\.[^/]+)?\z}i,
+ license: %r{\A((un)?licen[sc]e|copying)(\.[^/]+)?\z}i,
contributing: %r{\Acontributing[^/]*\z}i,
version: 'version',
avatar: /\Alogo\.(png|jpg|gif)\z/,
diff --git a/spec/lib/gitlab/file_detector_spec.rb b/spec/lib/gitlab/file_detector_spec.rb
index 8e524f9b05a..9e351368b22 100644
--- a/spec/lib/gitlab/file_detector_spec.rb
+++ b/spec/lib/gitlab/file_detector_spec.rb
@@ -29,11 +29,15 @@ describe Gitlab::FileDetector do
end
it 'returns the type of a license file' do
- %w(LICENSE LICENCE COPYING).each do |file|
+ %w(LICENSE LICENCE COPYING UNLICENSE UNLICENCE).each do |file|
expect(described_class.type_of(file)).to eq(:license)
end
end
+ it 'returns nil for an UNCOPYING file' do
+ expect(described_class.type_of('UNCOPYING')).to be_nil
+ end
+
it 'returns the type of a version file' do
expect(described_class.type_of('VERSION')).to eq(:version)
end