rjgit 5.9.0.0 → 5.9.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blob.rb +1 -1
- data/lib/rjgit.rb +29 -6
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f03c8f0d9e77ec4568625a3ec9cbfb87a5b6ec4ae7a1c1f540a5cde0599d9be
|
4
|
+
data.tar.gz: 81f752231d8d1714639f0422b9fb08fe3179837ab171f4ddb919d32159fab52b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '05482710f19d6205ca490ef7a3c49244ae584c1116a8de447d4eb34d7624d4b92e34fdd7d932752c823a62459b41b94afcb0052702a9e1389615831dd19d8388'
|
7
|
+
data.tar.gz: 74bff6ee3bc9361e1638697203d6cf64048408f2dcb9d2bc108ff0d7a69918a8fdbe3c27e5ed8a81e869267a413f32dc218e8a1b80ee517e0631ff90fcd1c060
|
data/lib/blob.rb
CHANGED
data/lib/rjgit.rb
CHANGED
@@ -56,10 +56,11 @@ module RJGit
|
|
56
56
|
|
57
57
|
# http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg00558.html
|
58
58
|
def self.cat_file(repository, blob)
|
59
|
+
mode = blob.mode if blob.respond_to?(:mode)
|
59
60
|
jrepo = RJGit.repository_type(repository)
|
60
61
|
jblob = RJGit.blob_type(blob)
|
61
62
|
# Try to resolve symlinks; return nil otherwise
|
62
|
-
mode
|
63
|
+
mode ||= RJGit.get_file_mode(jrepo, jblob)
|
63
64
|
if mode == SYMLINK_TYPE
|
64
65
|
symlink_source = jrepo.open(jblob.id).get_bytes.to_a.pack('c*').force_encoding('UTF-8')
|
65
66
|
blob = Blob.find_blob(jrepo, symlink_source)
|
@@ -209,15 +210,37 @@ module RJGit
|
|
209
210
|
|
210
211
|
query = Regexp.new(query.source, query.options | Regexp::IGNORECASE) if case_insensitive
|
211
212
|
|
212
|
-
|
213
|
-
|
214
|
-
|
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)
|
215
216
|
|
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")
|
217
240
|
data = rows.grep(query)
|
218
241
|
next if data.empty?
|
219
242
|
|
220
|
-
result[
|
243
|
+
result[file[:path]] = data
|
221
244
|
end
|
222
245
|
end
|
223
246
|
end
|
data/lib/version.rb
CHANGED
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.9.0.
|
4
|
+
version: 5.9.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maarten Engelen
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2020-11-
|
15
|
+
date: 2020-11-19 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|