Skip to content

Commit bc8d30b

Browse files
committed
fix tests by updating descriptor and supplement
1 parent fd9b5f2 commit bc8d30b

File tree

12 files changed

+205
-98
lines changed

12 files changed

+205
-98
lines changed

generate/descriptor.json

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,26 @@
230230
"cred": {
231231
"cType": "git_cred",
232232
"functions": {
233+
"git_cred_default_new":{
234+
"isAsync": false
235+
},
233236
"git_cred_ssh_custom_new": {
234237
"ignore": true
235238
},
236239
"git_cred_ssh_interactive_new": {
237240
"ignore": true
238241
},
242+
"git_cred_ssh_key_from_agent":{
243+
"isAsync": false
244+
},
245+
"git_cred_ssh_key_new":{
246+
"isAsync": false
247+
},
239248
"git_cred_userpass": {
240249
"ignore": true
250+
},
251+
"git_cred_userpass_plaintext_new": {
252+
"isAsync": false
241253
}
242254
}
243255
},
@@ -332,6 +344,13 @@
332344
"git_diff_tree_to_index": {
333345
"ignore": true
334346
},
347+
"git_diff_tree_to_tree": {
348+
"args": {
349+
"opts": {
350+
"isOptional": true
351+
}
352+
}
353+
},
335354
"git_diff_tree_to_workdir": {
336355
"ignore": true
337356
},
@@ -675,9 +694,15 @@
675694
"git_patch_from_buffers": {
676695
"ignore": true
677696
},
697+
"git_patch_from_diff": {
698+
"isAsync": false
699+
},
678700
"git_patch_get_hunk": {
679701
"ignore": true
680702
},
703+
"git_patch_get_line_in_hunk": {
704+
"isAsync": false
705+
},
681706
"git_patch_line_stats": {
682707
"ignore": true
683708
},
@@ -786,7 +811,11 @@
786811
"ignore": true
787812
},
788813
"git_remote_list": {
789-
"ignore": true
814+
"args": {
815+
"out": {
816+
"shouldAlloc": true
817+
}
818+
}
790819
},
791820
"git_remote_ls": {
792821
"ignore": true
@@ -839,11 +868,10 @@
839868
"git_revwalk_free": {
840869
"ignore": true
841870
},
842-
"git_revwalk_next": {
843-
"ignore": true
844-
},
845871
"git_revwalk_new": {
846-
"ignore": true
872+
"isAsync": false,
873+
"jsFunctionName": "createRevwalk",
874+
"cppFunctionName": "CreateRevwalk"
847875
}
848876
}
849877
},

generate/libgit2-supplement.json

Lines changed: 154 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,159 @@
11
{
2-
"types": [
3-
[
4-
"git_direction",
5-
{
6-
"type": "enum"
7-
}
8-
],
9-
[
10-
"git_merge_options",
11-
{
12-
"type": "struct",
13-
"fields": [
14-
{
15-
"type": "unsigned int",
16-
"name": "version"
17-
},
18-
{
19-
"type": "git_merge_tree_flag_t",
20-
"name": "flags"
21-
},
22-
{
23-
"type": "unsigned int",
24-
"name": "rename_threshold"
25-
},
26-
{
27-
"type": "unsigned int",
28-
"name": "target_limit"
29-
},
30-
{
31-
"type": "git_diff_similarity_metric *",
32-
"name": "metric",
33-
"ignore": true
34-
},
35-
{
36-
"type": "git_merge_file_favor_t",
37-
"name": "file_favor"
2+
"types": {
3+
"git_cred_default": {
4+
"decl": "git_cred"
5+
},
6+
"git_diff_hunk": {
7+
"decl": [
8+
"int old_start",
9+
"int old_lines",
10+
"int new_start",
11+
"int new_lines",
12+
"size_t header_len",
13+
"char header[128]"
14+
]
15+
},
16+
"git_diff_line": {
17+
"decl": [
18+
"int origin",
19+
"int old_lineno",
20+
"int new_lineno",
21+
"int num_lines",
22+
"size_t, content_len",
23+
"git_off_t content_offset",
24+
"const char * content"
25+
],
26+
"fields": [
27+
{
28+
"name": "origin",
29+
"type": "int"
30+
},
31+
{
32+
"name": "old_lineno",
33+
"type": "int"
34+
},
35+
{
36+
"name": "new_lineno",
37+
"type": "int"
38+
},
39+
{
40+
"name": "num_lines",
41+
"type": "int"
42+
},
43+
{
44+
"name": "content_len",
45+
"type": "size_t"
46+
},
47+
{
48+
"name": "content_offset",
49+
"type": "git_off_t"
50+
},
51+
{
52+
"name": "content",
53+
"type": "const char *"
54+
}
55+
]
56+
},
57+
"git_note_iterator": {
58+
"decl": "git_iterator"
59+
},
60+
"git_tree_entry": {
61+
"fields": [
62+
{
63+
"name": "removed",
64+
"type": "uint16_t"
65+
},
66+
{
67+
"name": "attr",
68+
"type": "uint16_t"
69+
},
70+
{
71+
"name": "oid",
72+
"type": "git_oid"
73+
},
74+
{
75+
"name": "filename_len",
76+
"type": "size_t"
77+
},
78+
{
79+
"name": "filename",
80+
"structType": "char",
81+
"structName": "filename[1]",
82+
"type": "char *"
83+
}
84+
]
85+
}
86+
},
87+
"new" : {
88+
"types": [
89+
[
90+
"git_direction",
91+
{
92+
"type": "enum"
93+
}
94+
],
95+
[
96+
"git_merge_options",
97+
{
98+
"type": "struct",
99+
"fields": [
100+
{
101+
"type": "unsigned int",
102+
"name": "version"
103+
},
104+
{
105+
"type": "git_merge_tree_flag_t",
106+
"name": "flags"
107+
},
108+
{
109+
"type": "unsigned int",
110+
"name": "rename_threshold"
111+
},
112+
{
113+
"type": "unsigned int",
114+
"name": "target_limit"
115+
},
116+
{
117+
"type": "git_diff_similarity_metric *",
118+
"name": "metric",
119+
"ignore": true
120+
},
121+
{
122+
"type": "git_merge_file_favor_t",
123+
"name": "file_favor"
124+
}
125+
],
126+
"used": {
127+
"needs": [
128+
"git_merge_init_options"
129+
]
38130
}
39-
],
40-
"used": {
41-
"needs": [
42-
"git_merge_init_options"
43-
]
44131
}
45-
}
46-
],
47-
[
48-
"git_off_t",
49-
{
50-
"type": "enum"
51-
}
52-
],
53-
[
54-
"git_remote_autotag_option_t",
55-
{
56-
"type": "enum"
57-
}
58-
],
59-
[
60-
"git_time_t",
61-
{
62-
"type": "enum"
63-
}
64-
],
65-
[
66-
"git_trace_level_t",
67-
{
68-
"type": "enum"
69-
}
132+
],
133+
[
134+
"git_off_t",
135+
{
136+
"type": "enum"
137+
}
138+
],
139+
[
140+
"git_remote_autotag_option_t",
141+
{
142+
"type": "enum"
143+
}
144+
],
145+
[
146+
"git_time_t",
147+
{
148+
"type": "enum"
149+
}
150+
],
151+
[
152+
"git_trace_level_t",
153+
{
154+
"type": "enum"
155+
}
156+
]
70157
]
71-
]
158+
}
72159
}

generate/setup.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ var descriptor = require("./descriptor.json");
88
var libgit2 = require("./v" + version + ".json");
99
var supplement = require("./libgit2-supplement.json");
1010

11+
libgit2.types.forEach(function(type) {
12+
if (supplement.types[type[0]]){
13+
_.merge(type[1], supplement.types[type[0]]);
14+
}
15+
});
1116

1217
// libgit2's docs aren't complete so we'll add in what they're missing here
13-
Array.prototype.push.apply(libgit2.types, supplement.types);
18+
Array.prototype.push.apply(libgit2.types, supplement.new.types);
19+
1420

1521
var output = [];
1622
var groupNames = [];

generate/templates/class_header.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extern "C" {
1515
#include "{{ dependency }}"
1616
{%endeach%}
1717

18-
{%if !needsForwardDeclaration%}
18+
{%if needsForwardDeclaration == true%}
1919
// Forward declaration.
2020
struct {{ cType }} {
2121
{%each fields as field%}

generate/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ var Utils = {
186186
Utils.decorateField(field, allFields, fieldOverrides[field.name] || {});
187187
});
188188

189-
typeDef.needsForwardDeclaration = typeDef.decl !== typeDef.cType;
189+
typeDef.needsForwardDeclaration = typeDef.decl === typeDef.cType;
190190

191191
_.merge(typeDef, partialOverrides);
192192
},

lib/commit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Commit.prototype.getEntry = function(path, callback) {
6060

6161
/**
6262
* Walk the history from this commit backwards.
63-
* An EventEmitter is returned that will emit a "commit" event for each
63+
* An EventEmitter is returned that will emit a "commit" event for each
6464
* commit in the history, and one "end" event when the walk is completed.
6565
* Don"t forget to call `start()` on the returned event.
6666
*
@@ -166,7 +166,7 @@ Commit.prototype.parents = function() {
166166
};
167167

168168
/**
169-
* Generate an array of diff trees showing changes between this commit
169+
* Generate an array of diff trees showing changes between this commit
170170
* and its parent(s).
171171
*
172172
* @param {Function} callback

lib/revwalk.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ var normalizeOid = require("./util/normalize_oid");
33

44
var Revwalk = NodeGit.Revwalk;
55

6-
// Backwards compatibility.
7-
Object.defineProperty(NodeGit, "RevWalk", {
8-
value: Revwalk,
9-
enumerable: false
10-
});
11-
126
var oldSorting = Revwalk.prototype.sorting;
137

148
/**

lib/tree_entry.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ var NodeGit = require("../");
33

44
var TreeEntry = NodeGit.TreeEntry;
55

6-
// Backwards compatibility.
7-
Object.defineProperty(TreeEntry.prototype, "name", {
8-
value: TreeEntry.prototype.filename,
9-
enumerable: false
10-
});
11-
126
/**
137
* Refer to vendor/libgit2/include/git2/types.h for filemode definitions.
148
*

test/tests/oid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe("Oid", function() {
88
var Oid = require("../../lib/oid");
99

1010
before(function() {
11-
this.oid = Oid.fromstr(oid);
11+
this.oid = Oid.fromString(oid);
1212
});
1313

1414
it("can convert a string to an oid", function() {

0 commit comments

Comments
 (0)