fast_ignore 0.17.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78cb85cea0888d67c91de09bd54ad644510167c993dc355d187593003d341393
4
- data.tar.gz: fb1fda9c1675ee28f4a6ff23191f95c2dd6e497ca2a70c4791dc5dfb85baecd1
3
+ metadata.gz: 88853f2613fe610772a13666845d500a4b377bbf5606e3fba3bd8842d66c17a2
4
+ data.tar.gz: c158117c0234816a067b3e68d7686e247bf18ea81e39b3c339fcf06ecc4026ae
5
5
  SHA512:
6
- metadata.gz: 10531a1d819b74fcc442ce7591be124430d3c55c55afbccb79ba295dd89c0e85e4a1a0a75b11996557057fa2f5dbad71e9284789143395d229e3abbbbd42ba3c
7
- data.tar.gz: d0b07a2757c3b962a59973581234ec9e346717d24cdbd5443073c0fd14f840fb287419d63eeb31d4aa52d3fff2e1c0842cc119ed52e836cd55ed73bcd29a3fc7
6
+ metadata.gz: a409a69b31021dedca95858ebed16abb4a36efbb758067dcab41bd6cbeb988acf0a62d4324f31cbb68ba4787efca4564cfc51721a50dc710f3357923775cc6e2
7
+ data.tar.gz: 4f0e0a8f900d6c0d008850eb8899c1c4446914149697539b9f708620054b614b310305e83df8743a3d5fb558a82ac08f0d48e44450486ad5de966943916a6ac2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.17.1
2
+ - fix handling of backward character classes `[z-a]`
3
+ previously this raised a RegexpError, but git just considered it to be identical to `[z]`, now we match the git behaviour (but why would you ever do this?, i only found it because of the fuzz spec in the `leftovers` gem)
4
+
1
5
  # v0.17.0
2
6
  - allow overriding `exists:` in `allowed?`
3
7
  - allow setting `include_directories: true` in `allowed?`
@@ -108,8 +108,8 @@ class FastIgnore
108
108
  unmatchable_rule! if @s.character_class_end?
109
109
 
110
110
  until @s.character_class_end?
111
+ next if process_character_class_range
111
112
  next if process_backslash
112
- next @re.append_character_class_dash if @s.dash?
113
113
  next if @re.append_escaped(@s.character_class_literal)
114
114
 
115
115
  unmatchable_rule!
@@ -118,6 +118,22 @@ class FastIgnore
118
118
  @re.append_character_class_close
119
119
  end
120
120
 
121
+ def process_character_class_range
122
+ start = @s.character_class_range_start
123
+ return unless start
124
+
125
+ start = start.delete_prefix('\\')
126
+
127
+ @re.append_escaped(start)
128
+
129
+ finish = @s.character_class_range_end.delete_prefix('\\')
130
+
131
+ return true unless start < finish
132
+
133
+ @re.append_character_class_dash
134
+ @re.append_escaped(finish)
135
+ end
136
+
121
137
  def process_end
122
138
  blank! if nothing_emitted?
123
139
 
@@ -46,12 +46,20 @@ class FastIgnore
46
46
  skip(/\?/)
47
47
  end
48
48
 
49
- def dash?
50
- skip(/-/)
49
+ def character_class_literal
50
+ matched if scan(/[^\]\\][^\]\\-]*(?!-)/)
51
51
  end
52
52
 
53
- def character_class_literal
54
- matched if scan(/[^\]\-\\]+/)
53
+ def character_class_range_start
54
+ matched if scan(/(\\.|[^\\\]])(?=-(\\.|[^\\\]]))/)
55
+ end
56
+
57
+ def character_class_range_end
58
+ # we already confirmed this was going to match
59
+ # with the lookahead in character_class_range_start
60
+ skip(/-/)
61
+ scan(/(\\.|[^\\\]])/)
62
+ matched
55
63
  end
56
64
 
57
65
  def literal
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class FastIgnore
4
- VERSION = '0.17.0'
4
+ VERSION = '0.17.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_ignore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dana Sherson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-03 00:00:00.000000000 Z
11
+ date: 2022-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  - !ruby/object:Gem::Version
219
219
  version: '0'
220
220
  requirements: []
221
- rubygems_version: 3.2.15
221
+ rubygems_version: 3.1.6
222
222
  signing_key:
223
223
  specification_version: 4
224
224
  summary: Parse gitignore files, quickly