gitlab-grit 1.0.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gitlab-grit might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +11 -2
- data/Rakefile +1 -1
- data/grit.gemspec +5 -5
- data/lib/grit.rb +1 -0
- data/lib/grit/commit.rb +4 -3
- data/lib/grit/diff.rb +1 -1
- data/lib/grit/git-ruby.rb +5 -2
- data/lib/grit/repo.rb +39 -1
- metadata +13 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e5aaa4e0035d8ae6e93e1ee9849f5fa066cfa0d4
|
4
|
+
data.tar.gz: 897dcc63e1ee07f7aa434461e4113438740a4dd8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 47d55d33d126f01d735684029dd0b00ab3666f011a15b31cf8b110020f6bef345c43bc1a8f460571608d55d39425a278abc7592eade49b92f4e48e74baf3a196
|
7
|
+
data.tar.gz: 6af007ace705ca20f49287915a0f8441abe610578d94f2e84d33ab784951115d1fffd786ca53b92b5c58644f4e53bfdaa0b5b2590f003c9cb9136f87bdf08f36
|
data/README.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
-
Grit
|
2
|
-
|
1
|
+
## Grit. GitLab fork
|
2
|
+
|
3
|
+
#### Code status
|
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)
|
3
12
|
|
4
13
|
|
5
14
|
|
data/Rakefile
CHANGED
data/grit.gemspec
CHANGED
@@ -4,14 +4,14 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.rubygems_version = '1.3.5'
|
5
5
|
|
6
6
|
s.name = 'gitlab-grit'
|
7
|
-
s.version = '
|
8
|
-
s.date = '2013-
|
9
|
-
s.
|
7
|
+
s.version = '2.5.0'
|
8
|
+
s.date = '2013-05-06'
|
9
|
+
s.license = 'MIT'
|
10
10
|
|
11
11
|
s.summary = "Ruby Git bindings."
|
12
|
-
s.description = "Grit is a Ruby library for extracting information from a git repository in an object oriented manner."
|
12
|
+
s.description = "Grit is a Ruby library for extracting information from a git repository in an object oriented manner. GitLab fork"
|
13
13
|
|
14
|
-
s.authors = ["Tom Preston-Werner", "Scott Chacon"]
|
14
|
+
s.authors = ["Tom Preston-Werner", "Scott Chacon", "Dmitriy Zaporozhets"]
|
15
15
|
s.email = 'm@gitlabhq.com'
|
16
16
|
s.homepage = 'http://github.com/gitlabhq/grit'
|
17
17
|
|
data/lib/grit.rb
CHANGED
data/lib/grit/commit.rb
CHANGED
@@ -137,7 +137,8 @@ module Grit
|
|
137
137
|
# - it broke when 'encoding' was introduced - not sure what else might show up
|
138
138
|
#
|
139
139
|
def self.list_from_string(repo, text)
|
140
|
-
|
140
|
+
text_gpgless = text.gsub(/gpgsig -----BEGIN PGP SIGNATURE-----[\n\r](.*[\n\r])*? -----END PGP SIGNATURE-----[\n\r]/, "")
|
141
|
+
lines = text_gpgless.split("\n")
|
141
142
|
|
142
143
|
commits = []
|
143
144
|
|
@@ -213,8 +214,8 @@ module Grit
|
|
213
214
|
diff = @repo.git.show({:full_index => true, :pretty => 'raw'}, @id)
|
214
215
|
end
|
215
216
|
|
216
|
-
if diff =~ /diff --git a/
|
217
|
-
diff = diff.sub(/.+?(diff --git a)/m, '\1')
|
217
|
+
if diff =~ /diff --git "?a/
|
218
|
+
diff = diff.sub(/.+?(diff --git "?a)/m, '\1')
|
218
219
|
else
|
219
220
|
diff = ''
|
220
221
|
end
|
data/lib/grit/diff.rb
CHANGED
@@ -29,7 +29,7 @@ module Grit
|
|
29
29
|
diffs = []
|
30
30
|
|
31
31
|
while !lines.empty?
|
32
|
-
m, a_path, b_path = *lines.shift.match(%r{^diff --git a
|
32
|
+
m, a_path, b_path = *lines.shift.match(%r{^diff --git "?a\/(.+?)(?<!\\)"? "?b\/(.+?)(?<!\\)"?$})
|
33
33
|
|
34
34
|
if lines.first =~ /^old mode/
|
35
35
|
m, a_mode = *lines.shift.match(/^old mode (\d+)/)
|
data/lib/grit/git-ruby.rb
CHANGED
@@ -3,7 +3,7 @@ require 'grit/git-ruby/repository'
|
|
3
3
|
module Grit
|
4
4
|
|
5
5
|
# the functions in this module intercept the calls to git binary
|
6
|
-
# made
|
6
|
+
# made by the grit objects and attempts to run them in pure ruby
|
7
7
|
# if it will be faster, or if the git binary is not available (!!TODO!!)
|
8
8
|
module GitRuby
|
9
9
|
|
@@ -75,7 +75,10 @@ module Grit
|
|
75
75
|
def rev_parse(options, string)
|
76
76
|
raise RuntimeError, "invalid string: #{string.inspect}" unless string.is_a?(String)
|
77
77
|
|
78
|
-
|
78
|
+
# Split ranges, but don't split when specifying a ref:path.
|
79
|
+
# Don't split HEAD:some/path/in/repo..txt
|
80
|
+
# Do split sha1..sha2
|
81
|
+
if string !~ /:/ && string =~ /\.\./
|
79
82
|
(sha1, sha2) = string.split('..')
|
80
83
|
return [rev_parse({}, sha1), rev_parse({}, sha2)]
|
81
84
|
end
|
data/lib/grit/repo.rb
CHANGED
@@ -412,7 +412,7 @@ module Grit
|
|
412
412
|
# The Commits objects that are newer than the specified date.
|
413
413
|
# Commits are returned in chronological order.
|
414
414
|
# +start+ is the branch/commit name (default 'master')
|
415
|
-
# +since+ is a string
|
415
|
+
# +since+ is a string representing a date/time
|
416
416
|
# +extra_options+ is a hash of extra options
|
417
417
|
#
|
418
418
|
# Returns Grit::Commit[] (baked)
|
@@ -713,6 +713,44 @@ module Grit
|
|
713
713
|
end
|
714
714
|
end
|
715
715
|
|
716
|
+
def grep(searchtext, contextlines = 3, branch = 'master')
|
717
|
+
context_arg = '-C ' + contextlines.to_s
|
718
|
+
result = git.native(:grep, {}, '-n', '-E', '-i', '-z', '--heading', '--break', context_arg, searchtext, branch).force_encoding('UTF-8')
|
719
|
+
greps = []
|
720
|
+
filematches = result.split("\n\n")
|
721
|
+
filematches.each do |filematch|
|
722
|
+
binary = false
|
723
|
+
file = ''
|
724
|
+
matches = filematch.split("--\n")
|
725
|
+
matches.each_with_index do |match, i|
|
726
|
+
content = []
|
727
|
+
startline = 0
|
728
|
+
lines = match.split("\n")
|
729
|
+
if i == 0
|
730
|
+
text = lines.first
|
731
|
+
lines.slice!(0)
|
732
|
+
file = text[/^Binary file (.+) matches$/]
|
733
|
+
if file
|
734
|
+
binary = true
|
735
|
+
else
|
736
|
+
text.slice! /^#{branch}:/
|
737
|
+
file = text
|
738
|
+
end
|
739
|
+
end
|
740
|
+
lines.each_with_index do |line, j|
|
741
|
+
line.chomp!
|
742
|
+
number, text = line.split("\0", 2)
|
743
|
+
if j == 0
|
744
|
+
startline = number.to_i
|
745
|
+
end
|
746
|
+
content << text
|
747
|
+
end
|
748
|
+
greps << Grit::Grep.new(self, file, startline, content, binary)
|
749
|
+
end
|
750
|
+
end
|
751
|
+
greps
|
752
|
+
end
|
753
|
+
|
716
754
|
# Pretty object inspection
|
717
755
|
def inspect
|
718
756
|
%Q{#<Grit::Repo "#{@path}">}
|
metadata
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-grit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tom Preston-Werner
|
9
8
|
- Scott Chacon
|
9
|
+
- Dmitriy Zaporozhets
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: posix-spawn
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
18
|
requirements:
|
20
19
|
- - ~>
|
21
20
|
- !ruby/object:Gem::Version
|
@@ -23,7 +22,6 @@ dependencies:
|
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
25
|
requirements:
|
28
26
|
- - ~>
|
29
27
|
- !ruby/object:Gem::Version
|
@@ -31,7 +29,6 @@ dependencies:
|
|
31
29
|
- !ruby/object:Gem::Dependency
|
32
30
|
name: mime-types
|
33
31
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
32
|
requirements:
|
36
33
|
- - ~>
|
37
34
|
- !ruby/object:Gem::Version
|
@@ -39,7 +36,6 @@ dependencies:
|
|
39
36
|
type: :runtime
|
40
37
|
prerelease: false
|
41
38
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
39
|
requirements:
|
44
40
|
- - ~>
|
45
41
|
- !ruby/object:Gem::Version
|
@@ -47,7 +43,6 @@ dependencies:
|
|
47
43
|
- !ruby/object:Gem::Dependency
|
48
44
|
name: diff-lcs
|
49
45
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
46
|
requirements:
|
52
47
|
- - ~>
|
53
48
|
- !ruby/object:Gem::Version
|
@@ -55,7 +50,6 @@ dependencies:
|
|
55
50
|
type: :runtime
|
56
51
|
prerelease: false
|
57
52
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
53
|
requirements:
|
60
54
|
- - ~>
|
61
55
|
- !ruby/object:Gem::Version
|
@@ -63,21 +57,19 @@ dependencies:
|
|
63
57
|
- !ruby/object:Gem::Dependency
|
64
58
|
name: mocha
|
65
59
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
60
|
requirements:
|
68
|
-
- -
|
61
|
+
- - '>='
|
69
62
|
- !ruby/object:Gem::Version
|
70
63
|
version: '0'
|
71
64
|
type: :development
|
72
65
|
prerelease: false
|
73
66
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
67
|
requirements:
|
76
|
-
- -
|
68
|
+
- - '>='
|
77
69
|
- !ruby/object:Gem::Version
|
78
70
|
version: '0'
|
79
71
|
description: Grit is a Ruby library for extracting information from a git repository
|
80
|
-
in an object oriented manner.
|
72
|
+
in an object oriented manner. GitLab fork
|
81
73
|
email: m@gitlabhq.com
|
82
74
|
executables: []
|
83
75
|
extensions: []
|
@@ -125,27 +117,27 @@ files:
|
|
125
117
|
- lib/grit/tag.rb
|
126
118
|
- lib/grit/tree.rb
|
127
119
|
homepage: http://github.com/gitlabhq/grit
|
128
|
-
licenses:
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
metadata: {}
|
129
123
|
post_install_message:
|
130
124
|
rdoc_options:
|
131
125
|
- --charset=UTF-8
|
132
126
|
require_paths:
|
133
127
|
- lib
|
134
128
|
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
-
none: false
|
136
129
|
requirements:
|
137
|
-
- -
|
130
|
+
- - '>='
|
138
131
|
- !ruby/object:Gem::Version
|
139
132
|
version: '0'
|
140
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
-
none: false
|
142
134
|
requirements:
|
143
|
-
- -
|
135
|
+
- - '>='
|
144
136
|
- !ruby/object:Gem::Version
|
145
137
|
version: '0'
|
146
138
|
requirements: []
|
147
|
-
rubyforge_project:
|
148
|
-
rubygems_version:
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.0.3
|
149
141
|
signing_key:
|
150
142
|
specification_version: 2
|
151
143
|
summary: Ruby Git bindings.
|