gitlab-grit 2.6.5 → 2.6.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -16
  3. data/VERSION +1 -1
  4. data/lib/grit_ext.rb +9 -3
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64a8b118ad835c82733051f1f950afa9f107e08b
4
- data.tar.gz: b51dcfd5613c248cdb9c2654bb870da5c6a80204
3
+ metadata.gz: 93e755061312f6d086b8189ea09986eba8f6d7f7
4
+ data.tar.gz: 26694a810ea758fd7290fc7404480a01e79ec8f4
5
5
  SHA512:
6
- metadata.gz: 359e1450304d9f783b54246186c5bd33dc4a44d52212c5b4785d87875336b537e0b802955e945658e279e962b48e9121effec1abf222bf0e31d185607d953409
7
- data.tar.gz: bd37bca63d26b93bf2d33d32888db73b9c919b7888deacb6fb0053b835963b5742056f9f02922df313e84046c840e9b9de47a2a9163dba5951bf22d59e7caa2b
6
+ metadata.gz: 3581bae92ece861513f96844c466958e9addbeb76875d15a8ecc21b7e1d31d17a70172a0996eadce9648c62fc9c0b9c804e45b6f0865281d2a524334d8a161f3
7
+ data.tar.gz: d845087cf2ee106636d5055777f412ae39d71098b8319dfe5410427a2e50c5321216a6426a88934bd943527406df361c6221bea78dd0311d5aaf9592b02c64e8
data/README.md CHANGED
@@ -2,13 +2,11 @@
2
2
 
3
3
  #### Code status
4
4
 
5
- * [![CI](http://ci.gitlab.org/projects/5/status?ref=master)](http://ci.gitlab.org/projects/5?ref=master)
6
-
7
- * [![build status](https://secure.travis-ci.org/gitlabhq/grit.png)](https://travis-ci.org/gitlabhq/grit)
8
-
9
- * [![Code Climate](https://codeclimate.com/github/gitlabhq/grit.png)](https://codeclimate.com/github/gitlabhq/grit)
10
-
11
- * [![Coverage Status](https://coveralls.io/repos/gitlabhq/grit/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/grit)
5
+ [![CI](http://ci.gitlab.org/projects/5/status?ref=master)](http://ci.gitlab.org/projects/5?ref=master)
6
+ [![build status](https://secure.travis-ci.org/gitlabhq/grit.png)](https://travis-ci.org/gitlabhq/grit)
7
+ [![Gem Version](https://badge.fury.io/rb/gitlab-grit.svg)](http://badge.fury.io/rb/gitlab-grit)
8
+ [![Code Climate](https://codeclimate.com/github/gitlabhq/grit.png)](https://codeclimate.com/github/gitlabhq/grit)
9
+ [![Coverage Status](https://coveralls.io/repos/gitlabhq/grit/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/grit)
12
10
 
13
11
 
14
12
  ## Fork changes
@@ -22,6 +20,7 @@ We patched existing grit library to use it inside GitLab
22
20
  * Handle filenames with spaces
23
21
  * Fixes symlinks omission from diff
24
22
  * Added Gemfile
23
+ * Ruby 2.0 support
25
24
  * and much more small fixes
26
25
 
27
26
 
@@ -38,9 +37,11 @@ This software was developed to power GitHub, and should be considered
38
37
  production ready. An extensive test suite is provided to verify its
39
38
  correctness.
40
39
 
41
- Grit is maintained by Tom Preston-Werner, Scott Chacon, Chris Wanstrath, and
40
+ Original Grit is maintained by Tom Preston-Werner, Scott Chacon, Chris Wanstrath, and
42
41
  PJ Hyett.
43
42
 
43
+ This fork is maintained by GitLab.com
44
+
44
45
  This documentation is accurate as of Grit 2.3.
45
46
 
46
47
 
@@ -60,19 +61,15 @@ Easiest install is via RubyGems:
60
61
 
61
62
  Grit's Git repo is available on GitHub, which can be browsed at:
62
63
 
63
- http://github.com/mojombo/grit
64
+ http://github.com/gitlabhq/grit
64
65
 
65
66
  and cloned with:
66
67
 
67
- git clone git://github.com/mojombo/grit.git
68
-
69
-
70
- ### Development
71
-
72
- You will need these gems to get tests to pass:
68
+ git clone git://github.com/gitlabhq/grit.git
73
69
 
74
- * mocha
70
+ If you're installing from source, you can use Bundler to pick up all the gems:
75
71
 
72
+ $ bundle install
76
73
 
77
74
  ### Contributing
78
75
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.6.5
1
+ 2.6.6
data/lib/grit_ext.rb CHANGED
@@ -14,11 +14,11 @@ module GritExt
14
14
 
15
15
  # if message is utf-8 encoding, just return it
16
16
  message.force_encoding("UTF-8")
17
- return message if message.valid_encoding?
17
+ return ensure_encoding(message) if message.valid_encoding?
18
18
 
19
19
  # return message if message type is binary
20
20
  detect = CharlockHolmes::EncodingDetector.detect(message)
21
- return message.force_encoding("BINARY") if detect && detect[:type] == :binary
21
+ return ensure_encoding(message.force_encoding("BINARY")) if detect && detect[:type] == :binary
22
22
 
23
23
  # encoding message to detect encoding
24
24
  if detect && detect[:encoding]
@@ -26,16 +26,22 @@ module GritExt
26
26
  end
27
27
 
28
28
  # encode and clean the bad chars
29
- message.replace clean(message)
29
+ message = message.replace clean(message)
30
+ ensure_encoding(message)
30
31
  rescue
31
32
  encoding = detect ? detect[:encoding] : "unknown"
32
33
  "--broken encoding: #{encoding}"
33
34
  end
34
35
 
35
36
  private
37
+
36
38
  def clean(message)
37
39
  message.encode("UTF-16BE", :undef => :replace, :invalid => :replace, :replace => "")
38
40
  .encode("UTF-8")
39
41
  .gsub("\0".encode("UTF-8"), "")
40
42
  end
43
+
44
+ def ensure_encoding(message)
45
+ message.encode('UTF-8', :invalid => :replace, :undef => :replace, :replace => "")
46
+ end
41
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-grit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.5
4
+ version: 2.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-04-04 00:00:00.000000000 Z
13
+ date: 2014-05-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: charlock_holmes