rjgit 5.7.0.1 → 5.10.0.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
  SHA256:
3
- metadata.gz: ee1618ecf4d5b33793cda5f7f2d4a83af873e48167ae426f144cbb21177beab0
4
- data.tar.gz: 95b32d3cbf4b5b85117986d1daa088180390d327b6503b9b042aa1055a00d20a
3
+ metadata.gz: db8d0dda74d80f506d1eb9e47b76bacb5eb6ee19b2e9f10b517e1889ebcce3b0
4
+ data.tar.gz: bed27ad0a32c0e9dbaab335d4c092ab2fa94076c8925a86d899109c54604f4ba
5
5
  SHA512:
6
- metadata.gz: 268fecedf6964680fc7e94c8fa4b3f66333d556976c154a0db0bbbb8121ee9e23bae563c4493bab07ed798d09b7c57d677062d1a5d5561e56f0d4ab56a256eab
7
- data.tar.gz: 00bfe427f864a3aa3854c5aac56b94d1067695dbd0bd6e2dcf8f7302ad6545bd6a55c0c656e6f897bd848a921be35545067ef328fcc577aa2010b7ff1c005c1f
6
+ metadata.gz: 884938ca23c5b35c242aed6eeca3f96e6da3f88ef8175566f597d14dad8c11b0998f2c4fc9c2cb776e8b3429806723014c38ce5de7801f649cede9a4f138524d
7
+ data.tar.gz: 44c9d47002da65f6505ea8b53b7a097374393b585eb723abbc18e7e6c87a1c8b4aa60456eac0956d7604d275cfc90721ee9387d1db6e05761dcd899a8d393183
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'mime-types', '~> 2.6.2'
3
+ gem 'mime-types', '~> 3.3.1'
4
4
  gem 'rake', '>= 12.3.3'
5
5
 
6
6
  gem 'coveralls', '~> 0.8.23', require: false
data/README.md CHANGED
@@ -6,6 +6,7 @@ RJGit
6
6
  [![Build Status](https://travis-ci.org/repotag/rjgit.png)](https://travis-ci.org/repotag/rjgit)
7
7
  [![Coverage Status](https://coveralls.io/repos/repotag/rjgit/badge.png?branch=master)](https://coveralls.io/r/repotag/rjgit)
8
8
  [![Gem Version](https://badge.fury.io/rb/rjgit.png)](http://badge.fury.io/rb/rjgit)
9
+ [![Cutting Edge Dependency Status](https://dometto-cuttingedge.herokuapp.com/github/repotag/rjgit/svg 'Cutting Edge Dependency Status')](https://dometto-cuttingedge.herokuapp.com/github/repotag/rjgit/info)
9
10
 
10
11
  Summary
11
12
  -------
@@ -36,7 +36,7 @@ module RJGit
36
36
  # The binary contents of this blob.
37
37
  # Returns String
38
38
  def data
39
- @data ||= RJGit::Porcelain.cat_file(@jrepo, @jblob)
39
+ @data ||= RJGit::Porcelain.cat_file(@jrepo, self)
40
40
  end
41
41
 
42
42
  def is_symlink?
data/lib/git.rb CHANGED
@@ -185,6 +185,7 @@ module RJGit
185
185
  if (SSH_TRANSPORTS.include? transport_protocol.to_s) || (options[:transport_protocol] == :ssh) || options[:private_key_file]
186
186
  command.set_transport_config_callback(RJGitSSHConfigCallback.new(options))
187
187
  elsif (HTTP_TRANSPORTS.include? transport_protocol.to_s) || options[:username]
188
+ options[:password] = '' unless options[:password]
188
189
  command.set_credentials_provider(UsernamePasswordCredentialsProvider.new(options[:username], options[:password]))
189
190
  end
190
191
  end
@@ -27,12 +27,17 @@ module RJGit
27
27
 
28
28
  module Porcelain
29
29
 
30
+ import 'java.io.IOException'
30
31
  import 'org.eclipse.jgit.lib.Constants'
31
32
  import 'org.eclipse.jgit.api.AddCommand'
32
33
  import 'org.eclipse.jgit.api.CommitCommand'
33
34
  import 'org.eclipse.jgit.api.BlameCommand'
35
+ import 'org.eclipse.jgit.api.errors.RefNotFoundException'
34
36
  import 'org.eclipse.jgit.blame.BlameGenerator'
35
37
  import 'org.eclipse.jgit.blame.BlameResult'
38
+ import 'org.eclipse.jgit.errors.IncorrectObjectTypeException'
39
+ import 'org.eclipse.jgit.errors.InvalidPatternException'
40
+ import 'org.eclipse.jgit.errors.MissingObjectException'
36
41
  import 'org.eclipse.jgit.treewalk.CanonicalTreeParser'
37
42
  import 'org.eclipse.jgit.diff.DiffFormatter'
38
43
 
@@ -51,10 +56,11 @@ module RJGit
51
56
 
52
57
  # http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg00558.html
53
58
  def self.cat_file(repository, blob)
59
+ mode = blob.mode if blob.respond_to?(:mode)
54
60
  jrepo = RJGit.repository_type(repository)
55
61
  jblob = RJGit.blob_type(blob)
56
62
  # Try to resolve symlinks; return nil otherwise
57
- mode = RJGit.get_file_mode(jrepo, jblob)
63
+ mode ||= RJGit.get_file_mode(jrepo, jblob)
58
64
  if mode == SYMLINK_TYPE
59
65
  symlink_source = jrepo.open(jblob.id).get_bytes.to_a.pack('c*').force_encoding('UTF-8')
60
66
  blob = Blob.find_blob(jrepo, symlink_source)
@@ -163,6 +169,80 @@ module RJGit
163
169
  RJGit.convert_diff_entries(diff_entries)
164
170
  end
165
171
 
172
+ def self.describe(repository, ref, options = {})
173
+ options = {:always => false, :long => false, :tags => false, :match => []}.merge(options)
174
+ repo = RJGit.repository_type(repository)
175
+ git = RubyGit.new(repo).jgit
176
+ command = git.describe.
177
+ set_always(options[:always]).
178
+ set_long(options[:long]).
179
+ set_tags(options[:tags])
180
+ begin
181
+ command = command.set_target(ref)
182
+ rescue IncorrectObjectTypeException, IOException, MissingObjectException, RefNotFoundException
183
+ return nil
184
+ end
185
+ options[:match].each do |match|
186
+ begin
187
+ command = command.set_match(match)
188
+ rescue InvalidPatternException
189
+ return nil
190
+ end
191
+ end
192
+ command.call
193
+ end
194
+
195
+ # options:
196
+ # * ref
197
+ # * path_filter
198
+ # * case_insensitive
199
+ def self.grep(repository, query, options={})
200
+ case_insensitive = options[:case_insensitive]
201
+ repo = RJGit.repository_type(repository)
202
+ walk = RevWalk.new(repo)
203
+ ls_tree_options = {:recursive => true, :path_filter => options[:path_filter]}
204
+
205
+ query = case query
206
+ when Regexp then query
207
+ when String then Regexp.new(Regexp.escape(query))
208
+ else raise "A #{query.class} was passed to #{self}.grep(). Only Regexps and Strings are supported!"
209
+ end
210
+
211
+ query = Regexp.new(query.source, query.options | Regexp::IGNORECASE) if case_insensitive
212
+
213
+ # We optimize below by first grepping the entire file, and then, if a match is found, then identifying the individual line.
214
+ # To avoid missing full-line matches during the optimization, we first convert multiline anchors to single-line anchors.
215
+ query = Regexp.new(query.source.gsub(/\A\\A/, '^').gsub(/\\z\z/, '$'), query.options)
216
+
217
+ ref = options.fetch(:ref, 'HEAD')
218
+ files_to_scan = ls_tree(repo, nil, ref, ls_tree_options)
219
+
220
+ files_to_scan.each_with_object({}) do |file, result|
221
+ id = if file[:mode] == SYMLINK_TYPE
222
+ symlink_source = repo.open(ObjectId.from_string(file[:id])).get_bytes.to_a.pack('c*').force_encoding('UTF-8')
223
+ unless symlink_source[File::SEPARATOR]
224
+ dir = file[:path].split(File::SEPARATOR)
225
+ dir[-1] = symlink_source
226
+ symlink_source = File.join(dir)
227
+ end
228
+ Blob.find_blob(repo, symlink_source, ref).jblob.id
229
+ else
230
+ ObjectId.from_string(file[:id])
231
+ end
232
+ bytes = repo.open(id).get_bytes
233
+
234
+ next if RawText.is_binary(bytes)
235
+
236
+ file_contents = bytes.to_s
237
+ next unless query.match(file_contents)
238
+
239
+ rows = file_contents.split("\n")
240
+ data = rows.grep(query)
241
+ next if data.empty?
242
+
243
+ result[file[:path]] = data
244
+ end
245
+ end
166
246
  end
167
247
 
168
248
  module Plumbing
@@ -1,3 +1,3 @@
1
1
  module RJGit
2
- VERSION = "5.7.0.1"
2
+ VERSION = "5.10.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rjgit
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.7.0.1
4
+ version: 5.10.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maarten Engelen
@@ -12,22 +12,22 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2020-04-29 00:00:00.000000000 Z
15
+ date: 2021-01-31 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '1.15'
22
+ version: '3.3'
23
23
  name: mime-types
24
- prerelease: false
25
24
  type: :runtime
25
+ prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
28
  - - "~>"
29
29
  - !ruby/object:Gem::Version
30
- version: '1.15'
30
+ version: '3.3'
31
31
  description: JRuby wrapper around the JGit library for manipulating git repositories
32
32
  in code.
33
33
  email: repotag-dev@googlegroups.com
@@ -45,11 +45,12 @@ files:
45
45
  - lib/config.rb
46
46
  - lib/constants.rb
47
47
  - lib/git.rb
48
- - lib/java/jars/bcpg-jdk15on-161.jar
49
- - lib/java/jars/bcpkix-jdk15on-161.jar
50
- - lib/java/jars/bcprov-jdk15on-161.jar
48
+ - lib/java/jars/bcpg-jdk15on-168.jar
49
+ - lib/java/jars/bcpkix-jdk15on-168.jar
50
+ - lib/java/jars/bcprov-jdk15on-168.jar
51
51
  - lib/java/jars/jsch-0.1.54.jar
52
- - lib/java/jars/org.eclipse.jgit-5.7.0.202003110725-r.jar
52
+ - lib/java/jars/org.eclipse.jgit-5.10.0.202012080955-r.jar
53
+ - lib/java/jars/org.eclipse.jgit.ssh.jsch-5.10.0.202012080955-r.jar
53
54
  - lib/java/jars/slf4j-api-1.7.2.jar
54
55
  - lib/java/jars/slf4j-simple-1.7.12.jar
55
56
  - lib/repo.rb
@@ -80,8 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
81
  - !ruby/object:Gem::Version
81
82
  version: '0'
82
83
  requirements: []
83
- rubyforge_project:
84
- rubygems_version: 2.6.13
84
+ rubygems_version: 3.0.9
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: JRuby wrapper around the JGit library.