gitlab_git 7.2.14 → 7.2.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/gitlab_git/blame.rb +8 -2
- data/lib/gitlab_git/encoding_helper.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8300790e0ccabd6e3bd4002e7d6cb7470dec69a
|
4
|
+
data.tar.gz: 2ab3c31f0b61acb76aa9f6cefa6a646a8935fb48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 919ebd7a6bc0edd28c29a72f1c193a3852b4d1318ac13dcd343cdb99e9df45f2b809ac7cded4ba9aa554f284c31c17578387aebd84543ed840436558139da0cf
|
7
|
+
data.tar.gz: 701f5e05964311896a145e60771455e8dfea685611a8d20db05c8fb6fe45eff5b8f7bcf459224930b51e362dc917c418b7f86e12794d73cc9da91b7d0ea75578
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.2.
|
1
|
+
7.2.15
|
data/lib/gitlab_git/blame.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
require_relative 'encoding_helper'
|
2
|
+
|
1
3
|
module Gitlab
|
2
4
|
module Git
|
3
5
|
class Blame
|
6
|
+
include EncodingHelper
|
7
|
+
|
4
8
|
attr_reader :lines, :blames
|
5
9
|
|
6
10
|
def initialize(repository, sha, path)
|
@@ -24,8 +28,10 @@ module Gitlab
|
|
24
28
|
|
25
29
|
def load_blame
|
26
30
|
cmd = %W(git --git-dir=#{@repo.path} blame -p #{@sha} -- #{@path})
|
27
|
-
|
28
|
-
|
31
|
+
# Read in binary mode to ensure ASCII-8BIT
|
32
|
+
raw_output = IO.popen(cmd, 'rb') {|io| io.read }
|
33
|
+
output = encode_utf8(raw_output)
|
34
|
+
process_raw_blame output
|
29
35
|
end
|
30
36
|
|
31
37
|
def process_raw_blame(output)
|
@@ -24,6 +24,15 @@ module EncodingHelper
|
|
24
24
|
"--broken encoding: #{encoding}"
|
25
25
|
end
|
26
26
|
|
27
|
+
def encode_utf8(message)
|
28
|
+
detect = CharlockHolmes::EncodingDetector.detect(message)
|
29
|
+
if detect
|
30
|
+
CharlockHolmes::Converter.convert(message, detect[:encoding], 'UTF-8')
|
31
|
+
else
|
32
|
+
clean(message)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
27
36
|
private
|
28
37
|
|
29
38
|
def clean(message)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.2.
|
4
|
+
version: 7.2.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitriy Zaporozhets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab-linguist
|