gitattributes 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2759e748dc351ded9388399184c90221e585fa4
4
- data.tar.gz: e0806187ce98ed16a53d968ab396509c0d4b796c
3
+ metadata.gz: f126e35bb048a9aa68b62eba4593cc7a040aa0ec
4
+ data.tar.gz: 240a38cf94ba4d0797bfa5080c4a9cfc652c6e18
5
5
  SHA512:
6
- metadata.gz: c97e8f630ef87a46056c906f655004c3ac15bbf5dd93e4e51eb3a2eb1f07ee8714935e881d7ff805e2b9f5ac8c7ed124af08e73229afa844f30ca6862fdedc36
7
- data.tar.gz: a7163bb1a24119ebe960bbd902146b922da59bee50417259a139f8175d188e518f4cfa654bea741bdd8da4aea245a7115194b2b552336ede42cb2497e16834bf
6
+ metadata.gz: 117bc70ee90fb3158d36300516a8e6a8d3d1a6e30dd136de484e90c3f190f1cf3ee8a0039d4239ec02d70461e46a9d41f09980155cfa100aa8eaf67eb3b668f1
7
+ data.tar.gz: ae70b802be7c8a80edb5092606c75e394e1a6c9637404ea2e9ca2cd583c57ac6b8f1e54b5b78c4f87e1e743f93a771cc6c98a42785ebee6d5af444bab565d8a6
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{gitattributes}
5
- s.version = '2.2.0'
5
+ s.version = '2.3.0'
6
6
  s.platform = Gem::Platform::RUBY
7
7
 
8
8
  s.authors = ['Peter Donald']
@@ -19,7 +19,7 @@ module Reality #nodoc
19
19
  ATTR_ORDER = %w(text binary eol encoding eofnl)
20
20
 
21
21
  def initialize(pattern, attributes)
22
- @pattern = pattern
22
+ @pattern = pattern.gsub('[[:space:]]', ' ')
23
23
  @attributes = {}
24
24
  @priority = 1
25
25
  attributes.each do |k, v|
@@ -36,7 +36,7 @@ module Reality #nodoc
36
36
  attr_reader :priority
37
37
 
38
38
  def to_s
39
- rule = self.pattern
39
+ rule = self.pattern.gsub(' ','[[:space:]]')
40
40
 
41
41
  attributes = self.attributes.dup
42
42
  ATTR_ORDER.each do |key|
@@ -18,6 +18,7 @@ class Reality::Git::TestAttributeRule < Reality::TestCase
18
18
  def test_basic_operation
19
19
  rule = Reality::Git::AttributeRule.new('*', 'text' => false)
20
20
  assert_equal({ 'text' => false }, rule.attributes)
21
+ assert_equal('*', rule.pattern)
21
22
  assert_equal('* -text', rule.to_s)
22
23
  assert_equal(1, rule.priority)
23
24
  end
@@ -26,15 +27,24 @@ class Reality::Git::TestAttributeRule < Reality::TestCase
26
27
  rule = Reality::Git::AttributeRule.new('*', 'text' => false, 'priority' => 3)
27
28
  assert_equal(3, rule.priority)
28
29
  assert_equal({ 'text' => false }, rule.attributes)
30
+ assert_equal('*', rule.pattern)
29
31
  assert_equal('* -text', rule.to_s)
30
32
  end
31
33
 
32
34
  def test_many_attributes
33
35
  rule = Reality::Git::AttributeRule.new('*.rdl', 'eofnl' => false, 'text' => true, 'crlf' => true, 'binary' => false, 'ms-file' => 'RPT', 'age' => '22')
34
36
  assert_equal({ 'eofnl' => false, 'text' => true, 'crlf' => true, 'binary' => false, 'ms-file' => 'RPT', 'age' => '22' }, rule.attributes)
37
+ assert_equal('*.rdl', rule.pattern)
35
38
  assert_equal('*.rdl text -binary -eofnl age=22 crlf ms-file=RPT', rule.to_s)
36
39
  end
37
40
 
41
+ def test_whitespace_pattern_convertee
42
+ rule = Reality::Git::AttributeRule.new('Read[[:space:]]Me.txt', 'text' => true, 'crlf' => true)
43
+ assert_equal({ 'text' => true, 'crlf' => true }, rule.attributes)
44
+ assert_equal('Read Me.txt', rule.pattern)
45
+ assert_equal('Read[[:space:]]Me.txt text crlf', rule.to_s)
46
+ end
47
+
38
48
  def test_sorting
39
49
  rule1 = Reality::Git::AttributeRule.new('*.a', 'priority' => 2, 'text' => true)
40
50
  rule2 = Reality::Git::AttributeRule.new('*.b', 'priority' => 2, 'text' => true)
@@ -29,6 +29,20 @@ TEXT
29
29
  assert_equal({ 'text' => false }, attributes.attributes('README.md'))
30
30
  end
31
31
 
32
+ def test_space_pattern_in_rule
33
+ content = <<TEXT
34
+ Read[[:space:]]Me.txt text crlf
35
+ TEXT
36
+ dir = "#{working_dir}/#{::SecureRandom.hex}"
37
+ write_standard_file(dir, content)
38
+
39
+ attributes = Reality::Git::Attributes.parse(dir)
40
+ assert_equal("#{dir}/.gitattributes", attributes.attributes_file)
41
+ assert_equal(['Read[[:space:]]Me.txt text crlf'], attributes.rules.collect {|p| p.to_s})
42
+
43
+ assert_equal({ 'text' => true, 'crlf' => true }, attributes.attributes('Read Me.txt'))
44
+ end
45
+
32
46
  def test_gitattributes_in_non_standard_location
33
47
  content = <<TEXT
34
48
  * -text
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitattributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Donald
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-05 00:00:00.000000000 Z
11
+ date: 2017-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest