git_miner 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +17 -17
- data/ext/git_miner_ext/GitMinerExt.c +19 -13
- data/ext/git_miner_ext/extconf.rb +3 -0
- data/lib/git_miner/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19036e9a860b64229bdf5abee8d489b155e325c2520b709707a4417821b93f92
|
4
|
+
data.tar.gz: 1b79a6eeab4b439777646ce8763a3c35cc9c3f776794cf0d828871c6609ebae9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be3d54581beda0968cc66199a8d67de09633f7fa4af3073c590fe18990c1e51419deb14cd2a49e3e792ab47160368f907eac17372154659d1de2b0c9935eafe4
|
7
|
+
data.tar.gz: 185f6efc588f2aed729856911a5bd34af54e3b3a01c5018354440ad3ce560cd662e5dfbcb4147af49ce2bb80c8a4996674b82d2886cf6693aa89e44a9ed987d7
|
data/Gemfile.lock
CHANGED
@@ -1,32 +1,32 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
git_miner (0.2.
|
4
|
+
git_miner (0.2.4)
|
5
5
|
concurrent-ruby (~> 1.1)
|
6
6
|
parallel (~> 1.17)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
concurrent-ruby (1.1.
|
12
|
-
diff-lcs (1.
|
13
|
-
parallel (1.
|
14
|
-
rake (13.0.
|
15
|
-
rake-compiler (1.
|
11
|
+
concurrent-ruby (1.1.10)
|
12
|
+
diff-lcs (1.5.0)
|
13
|
+
parallel (1.22.1)
|
14
|
+
rake (13.0.6)
|
15
|
+
rake-compiler (1.2.1)
|
16
16
|
rake
|
17
|
-
rspec (3.
|
18
|
-
rspec-core (~> 3.
|
19
|
-
rspec-expectations (~> 3.
|
20
|
-
rspec-mocks (~> 3.
|
21
|
-
rspec-core (3.
|
22
|
-
rspec-support (~> 3.
|
23
|
-
rspec-expectations (3.
|
17
|
+
rspec (3.12.0)
|
18
|
+
rspec-core (~> 3.12.0)
|
19
|
+
rspec-expectations (~> 3.12.0)
|
20
|
+
rspec-mocks (~> 3.12.0)
|
21
|
+
rspec-core (3.12.0)
|
22
|
+
rspec-support (~> 3.12.0)
|
23
|
+
rspec-expectations (3.12.1)
|
24
24
|
diff-lcs (>= 1.2.0, < 2.0)
|
25
|
-
rspec-support (~> 3.
|
26
|
-
rspec-mocks (3.
|
25
|
+
rspec-support (~> 3.12.0)
|
26
|
+
rspec-mocks (3.12.1)
|
27
27
|
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
-
rspec-support (~> 3.
|
29
|
-
rspec-support (3.
|
28
|
+
rspec-support (~> 3.12.0)
|
29
|
+
rspec-support (3.12.0)
|
30
30
|
|
31
31
|
PLATFORMS
|
32
32
|
ruby
|
@@ -1,14 +1,15 @@
|
|
1
1
|
#include "ruby.h"
|
2
|
-
|
2
|
+
|
3
3
|
#include <stdio.h>
|
4
4
|
#include <stdbool.h>
|
5
|
+
#include <openssl/sha.h>
|
5
6
|
|
6
7
|
VALUE GitMinerExt = Qnil;
|
7
8
|
|
8
9
|
void Init_git_miner_ext();
|
9
10
|
|
10
11
|
VALUE rb_sha1_hexdigest(VALUE self, VALUE rbString);
|
11
|
-
VALUE rb_sha1_mine(VALUE self,
|
12
|
+
VALUE rb_sha1_mine(VALUE self, VALUE vAuthorOffset, VALUE vCommitterOffset, VALUE vQty);
|
12
13
|
|
13
14
|
void Init_git_miner_ext() {
|
14
15
|
GitMinerExt = rb_define_module("GitMinerExt");
|
@@ -18,9 +19,9 @@ void Init_git_miner_ext() {
|
|
18
19
|
|
19
20
|
VALUE rb_sha1_hexdigest(VALUE self, VALUE rbString) {
|
20
21
|
unsigned char result[SHA_DIGEST_LENGTH];
|
21
|
-
const char
|
22
|
+
const char* string = StringValueCStr(rbString);
|
22
23
|
|
23
|
-
SHA1(string, strlen(string), result);
|
24
|
+
SHA1( (unsigned char*) string, strlen(string), result);
|
24
25
|
|
25
26
|
unsigned char resultHex[SHA_DIGEST_LENGTH*2 + 1];
|
26
27
|
int i = 0;
|
@@ -28,11 +29,15 @@ VALUE rb_sha1_hexdigest(VALUE self, VALUE rbString) {
|
|
28
29
|
sprintf((char*)&(resultHex[i*2]), "%02x", result[i]);
|
29
30
|
}
|
30
31
|
|
31
|
-
printf("ShaGenDebug: %s\n", resultHex);
|
32
|
-
return rb_str_new_cstr(resultHex);
|
32
|
+
printf("ShaGenDebug: %s\n",(char*) resultHex);
|
33
|
+
return rb_str_new_cstr((char*) resultHex);
|
33
34
|
}
|
34
35
|
|
35
|
-
VALUE rb_sha1_mine(VALUE self,
|
36
|
+
VALUE rb_sha1_mine(VALUE self, VALUE vAuthorOffset, VALUE vCommitterOffset, VALUE vQty) {
|
37
|
+
long authorOffset = FIX2LONG(vAuthorOffset);
|
38
|
+
long committerOffset = FIX2LONG(vCommitterOffset);
|
39
|
+
int qty = FIX2INT(vQty);
|
40
|
+
|
36
41
|
VALUE rbPrefix = rb_iv_get(self, "@prefix");
|
37
42
|
char* prefix = StringValueCStr(rbPrefix);
|
38
43
|
|
@@ -75,24 +80,25 @@ VALUE rb_sha1_mine(VALUE self, int authorOffset, int committerOffset, int qty) {
|
|
75
80
|
gitHeadTree,
|
76
81
|
gitHeadParent,
|
77
82
|
gitHeadAuthorPrefix,
|
78
|
-
timestamp - authorOffset,
|
83
|
+
(int) (timestamp - authorOffset),
|
79
84
|
gitHeadCommitterPrefix,
|
80
|
-
timestamp - committerOffset,
|
85
|
+
(int) (timestamp - committerOffset),
|
81
86
|
gitHeadMessage
|
82
87
|
);
|
83
88
|
|
84
|
-
sprintf(commitPrefix, "commit %d", strlen(currentHead));
|
89
|
+
sprintf(commitPrefix, "commit %d", (int) strlen(currentHead));
|
85
90
|
sprintf(currentCommit, "%s_%s", commitPrefix, currentHead);
|
86
91
|
currentCommit[strlen(commitPrefix)] = '\0';
|
87
92
|
|
88
|
-
shaLen = strlen(commitPrefix) + 1 + strlen(currentHead);
|
89
|
-
|
93
|
+
shaLen = (int) strlen(commitPrefix) + 1 + (int) strlen(currentHead);
|
94
|
+
|
95
|
+
SHA1( (unsigned char*) currentCommit, shaLen, currentSha);
|
90
96
|
|
91
97
|
for (int j = 0; j < SHA_DIGEST_LENGTH; j++) {
|
92
98
|
sprintf((char*)&(currentHex[j*2]), "%02x", currentSha[j]);
|
93
99
|
}
|
94
100
|
|
95
|
-
int prefixLen = strlen(prefix);
|
101
|
+
int prefixLen = (int) strlen(prefix);
|
96
102
|
bool match = true;
|
97
103
|
for(int j = 0; j < prefixLen; j++) {
|
98
104
|
match = match && (prefix[j] == currentHex[j]);
|
data/lib/git_miner/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_miner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thierry Joyal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
|
-
rubygems_version: 3.
|
153
|
+
rubygems_version: 3.3.26
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: git-mine shell executable
|