Skip to content

Commit 11bc101

Browse files
authored
Dedup files (#8)
1 parent 7d62389 commit 11bc101

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
code_manifest (1.8.0)
4+
code_manifest (1.9.0)
55
psych (>= 4.0.0)
66

77
GEM
@@ -50,4 +50,4 @@ DEPENDENCIES
5050
rspec
5151

5252
BUNDLED WITH
53-
2.5.4
53+
2.5.23

lib/code_manifest/manifest.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def initialize(patterns)
1818

1919
def files
2020
@files ||= begin
21-
matched_files = matches(Dir.glob(inclusion_rules.map(&:glob), GLOB_OPTIONS, base: CodeManifest.root))
21+
matched_files = matches(Dir.glob(inclusion_rules.map(&:glob), GLOB_OPTIONS, base: CodeManifest.root)).uniq
2222
files_with_relative_path(matched_files).freeze
2323
end
2424
end

lib/code_manifest/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module CodeManifest
4-
VERSION = '1.8.0'
4+
VERSION = '1.9.0'
55
end

spec/lib/code_manifest/manifest_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
expect(manifest.files).to match_array(['bar/include', 'foo/foo.md'])
2222
end
2323

24+
context 'when there are duplicate patterns' do
25+
let(:patterns) { ['/foo/foo.md', 'bar/*', '!bar/exclude', 'bar/*'] }
26+
27+
it 'dedups files' do
28+
expect(manifest.files).to match_array(['bar/include', 'foo/foo.md'])
29+
end
30+
end
31+
2432
context 'with different type of globs' do
2533
let(:patterns) { ['dir_bar/**/*'] }
2634
let(:manifest) { described_class.new(patterns) }

0 commit comments

Comments
 (0)