Skip to content

Commit 331cd65

Browse files
committed
Renamed index->nodegit, fixed signature issue.
- Missing `dup` property in the `return` for the `git_commit_author` method. - Renamed index.js -> nodegit.js for consistency.
1 parent ab751c5 commit 331cd65

9 files changed

Lines changed: 183 additions & 169 deletions

File tree

binding.gyp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99

1010
"sources": [
1111
# Maintained.
12-
"src/base.cc",
12+
"src/nodegit.cc",
1313
"src/wrapper.cc",
1414
"src/functions/copy.cc",
1515

1616
# Generated files.
1717
"src/blob.cc",
18+
"src/clone.cc",
1819
"src/commit.cc",
1920
"src/config.cc",
21+
#"src/diff.cc",
2022
"src/index.cc",
2123
"src/object.cc",
2224
"src/odb.cc",
@@ -30,6 +32,7 @@
3032
"src/time.cc",
3133
"src/trace.cc",
3234
"src/tree.cc",
35+
"src/treebuilder.cc",
3336
"src/tree_entry.cc",
3437
],
3538

generate/descriptor.json

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
},
5454

5555
"clone": {
56-
"ignore": true,
56+
"ignore": false,
5757
"cType": null
5858
},
5959

@@ -90,12 +90,18 @@
9090

9191
"git_commit_author": {
9292
"ignore": false,
93-
"args": [{ "isSelf": true }]
93+
"args": [{ "isSelf": true }],
94+
"return": {
95+
"copy": "git_signature_dup"
96+
}
9497
},
9598

9699
"git_commit_committer": {
97100
"ignore": false,
98-
"args": [{ "isSelf": true }]
101+
"args": [{ "isSelf": true }],
102+
"return": {
103+
"copy": "git_signature_dup"
104+
}
99105
},
100106

101107
"git_commit_parentcount": {
@@ -139,6 +145,44 @@
139145
}
140146
},
141147

148+
"diff_options": {
149+
"ignore": false,
150+
151+
"isStruct": true,
152+
"cType": "git_diff_options",
153+
154+
"dependencies": [
155+
"../include/diff.h",
156+
"../include/types.h"
157+
],
158+
159+
"fields": [
160+
{
161+
"name": "filename",
162+
"structType": "char",
163+
"structName": "filename[1]",
164+
"cType": "char *"
165+
}, {
166+
"name": "attr",
167+
"cType": "uint16_t"
168+
},
169+
{
170+
"name": "oid",
171+
"cType": "git_oid"
172+
},
173+
{
174+
"name": "filename_len",
175+
"cType": "size_t"
176+
},
177+
{
178+
"name": "filename",
179+
"structType": "char",
180+
"structName": "filename[1]",
181+
"cType": "char *"
182+
}
183+
]
184+
},
185+
142186
"errors": {
143187
"ignore": true,
144188
"cType": null
@@ -277,7 +321,7 @@
277321
},
278322

279323
"remote": {
280-
"ignore": true
324+
"ignore": false
281325
},
282326

283327
"repository": {
@@ -360,6 +404,16 @@
360404
"../include/time.h"
361405
],
362406

407+
"functions": {
408+
"git_signature_new": {
409+
"ignore": false,
410+
"isAsync": false,
411+
"isConstructorMethod": true,
412+
"jsFunctionName": "create",
413+
"cppFunctionName": "Create"
414+
}
415+
},
416+
363417
"fields": [
364418
{
365419
"name": "name",
@@ -438,7 +492,7 @@
438492
},
439493

440494
"transport": {
441-
"ignore": true
495+
"ignore": false
442496
},
443497

444498
"tree": {

generate/types.json

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -616,8 +616,8 @@
616616
"js": "blobs"
617617
},
618618
"const git_diff_options *": {
619-
"js": "DiffOptions",
620-
"cpp": "GitDiffOptions"
619+
"cpp": "GitDiffOptions",
620+
"js": "DiffOptions"
621621
},
622622
"git_diff_blob_to_buffer": {
623623
"cpp": "BlobToBuffer",
@@ -2137,8 +2137,8 @@
21372137
"js": "repository"
21382138
},
21392139
"git_signature_new": {
2140-
"cpp": "New2",
2141-
"js": "new2"
2140+
"cpp": "Create",
2141+
"js": "create"
21422142
},
21432143
"git_signature **": {
21442144
"cpp": "GitSignature",
@@ -7493,12 +7493,12 @@
74937493
"js": "Signature"
74947494
},
74957495
"git_signature_new *": {
7496-
"cpp": "New2",
7497-
"js": "new2"
7496+
"cpp": "Create",
7497+
"js": "create"
74987498
},
74997499
"const git_signature_new *": {
7500-
"cpp": "New2",
7501-
"js": "new2"
7500+
"cpp": "Create",
7501+
"js": "create"
75027502
},
75037503
"git_signature_now *": {
75047504
"cpp": "Now",
@@ -8967,5 +8967,21 @@
89678967
"const git_reference__alloc_symbolic *": {
89688968
"cpp": "AllocSymbolic",
89698969
"js": "allocSymbolic"
8970+
},
8971+
"git_diff_options": {
8972+
"cpp": "GitDiffOptions",
8973+
"js": "DiffOptions"
8974+
},
8975+
"git_diff_options **": {
8976+
"cpp": "GitDiffOptions",
8977+
"js": "DiffOptions"
8978+
},
8979+
"git_diff_options *": {
8980+
"cpp": "GitDiffOptions",
8981+
"js": "DiffOptions"
8982+
},
8983+
"const git_diff_options **": {
8984+
"cpp": "GitDiffOptions",
8985+
"js": "DiffOptions"
89708986
}
89718987
}

index.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

lib/nodegit.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
var rawApi;
2+
3+
// Attempt to load the production release first, if it fails fall back to the
4+
// debug release.
5+
try {
6+
rawApi = require('../build/Release/nodegit');
7+
}
8+
catch (e) {
9+
rawApi = require('../build/Debug/nodegit');
10+
}
11+
12+
// Set the exports prototype to the raw API.
13+
exports.__proto__ = rawApi;
14+
15+
// Import extensions
16+
require('./commit.js');
17+
require('./blob.js');
18+
require('./object.js');
19+
require('./signature.js');
20+
require('./odb.js');
21+
require('./oid.js');
22+
require('./index.js');
23+
require('./repository.js');
24+
require('./reference.js');
25+
require('./revwalk.js');
26+
require('./tree.js');
27+
28+
// Set version
29+
exports.version = require('../package').version;
30+
31+
// Initialize threads
32+
exports.Threads.threadsInit();

lib/tree.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ var TreeEntry = require('./tree_entry');
44
var events = require('events');
55
var path = require('path');
66

7-
var oldEntryByIndex = Tree.prototype.entryByindex,
8-
oldEntryByName = Tree.prototype.entryByname,
9-
oldGetEntry = Tree.prototype.entryBypath;
7+
var oldBuilder = Tree.prototype.builder;
8+
var oldEntryByIndex = Tree.prototype.entryByindex;
9+
var oldEntryByName = Tree.prototype.entryByname;
10+
var oldGetEntry = Tree.prototype.entryBypath;
1011

1112
// Backwards compatibility.
1213
Object.defineProperties(Tree.prototype, {
@@ -144,7 +145,6 @@ Tree.prototype.path = function(blobsOnly) {
144145
* Make builder. This is helpful for modifying trees.
145146
* @return {TreeBuilder}
146147
*/
147-
var oldBuilder = Tree.prototype.builder;
148148
Tree.prototype.builder = function() {
149149
var builder = oldBuilder.call(this);
150150
builder.root = builder;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"name": "Nick Kallen"
2525
}
2626
],
27-
"main": "index.js",
27+
"main": "lib/nodegit.js",
2828
"repository": {
2929
"type": "git",
3030
"url": "git://github.com/tbranyen/nodegit.git"

src/base.cc

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)