Skip to content

Commit 95f6951

Browse files
committed
Added new methods in checkout and repository
1 parent b8a94ae commit 95f6951

File tree

6 files changed

+206
-35
lines changed

6 files changed

+206
-35
lines changed

generate/descriptor.json

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,40 @@
9292
},
9393

9494
"checkout": {
95-
"cType": null
95+
"cType": null,
96+
97+
"dependencies": [
98+
"../include/functions/copy.h",
99+
"../include/checkout.h",
100+
"../include/checkout_options.h",
101+
"../include/repository.h",
102+
"../include/index.h",
103+
"../include/object.h"
104+
],
105+
106+
"functions": {
107+
"git_checkout_head": {
108+
"ignore": false
109+
},
110+
111+
"git_checkout_index": {
112+
"ignore": false
113+
},
114+
115+
"git_checkout_tree": {
116+
"ignore": false
117+
},
118+
119+
"git_checkout_init_options": {
120+
"ignore": false
121+
}
122+
}
123+
},
124+
125+
"checkout_options": {
126+
"isStruct": true,
127+
"cType": "git_checkout_options",
128+
"fields": []
96129
},
97130

98131
"clone": {
@@ -595,6 +628,18 @@
595628
},
596629

597630
"repository": {
631+
"dependencies": [
632+
"../include/functions/copy.h",
633+
"../include/repository.h",
634+
"../include/repository.h",
635+
"../include/odb.h",
636+
"../include/config.h",
637+
"../include/refdb.h",
638+
"../include/index.h",
639+
"../include/oid.h",
640+
"../include/repository_init_options.h"
641+
],
642+
598643
"functions": {
599644
"git_repository_open": {
600645
"isConstructorMethod": true,
@@ -608,10 +653,26 @@
608653
"git_repository_init": {
609654
"isConstructorMethod": true,
610655
"ignore": false
656+
},
657+
658+
"git_repository_init_ext": {
659+
"isConstructorMethod": true,
660+
"ignore": false
661+
},
662+
663+
"git_repository_init_init_options": {
664+
"ignore": false,
665+
"isConstructorMethod": true
611666
}
612667
}
613668
},
614669

670+
"repository_init_options": {
671+
"isStruct": true,
672+
"cType": "git_repository_init_options",
673+
"fields": []
674+
},
675+
615676
"reset": {
616677
"cType": null
617678
},

generate/setup.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ typeMap.__proto__ = {
4242
"git_filter_check_fn": { cpp: "Function", js: "Function" },
4343
"git_filter_apply_fn": { cpp: "Function", js: "Function" },
4444
"git_filter_cleanup_fn": { cpp: "Function", js: "Function" },
45+
"const git_checkout_options *": { cpp: "GitCheckoutOptions", js: "CheckoutOptions" },
46+
"git_checkout_notify_cb": { cpp: "Function", js: "Function" },
47+
"git_checkout_progress_cb": { cpp: "Function", js: "Function" },
48+
"git_cherry_pick_options *": { cpp: "GitCherryPickOptions", js: "CherryPickOptions" },
49+
"const git_cherry_pick_options *": { cpp: "GitCherryPickOptions", js: "CherryPickOptions" },
50+
"const git_merge_options *": { cpp: "GitMergeOptions", js: "MergeOptions" }
4551
};
4652

4753
var files = [];

generate/types.json

Lines changed: 101 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -168,24 +168,24 @@
168168
"js": "branchRemoteName"
169169
},
170170
"git_checkout_head": {
171-
"cpp": "CheckoutHead",
172-
"js": "checkoutHead"
171+
"cpp": "Head",
172+
"js": "head"
173173
},
174174
"git_checkout_opts *": {
175175
"js": "CheckoutOpts",
176176
"cpp": "CheckoutOpts"
177177
},
178178
"git_checkout_index": {
179-
"cpp": "CheckoutIndex",
180-
"js": "checkoutIndex"
179+
"cpp": "Index",
180+
"js": "index"
181181
},
182182
"git_index *": {
183183
"cpp": "GitIndex",
184184
"js": "Index"
185185
},
186186
"git_checkout_tree": {
187-
"cpp": "CheckoutTree",
188-
"js": "checkoutTree"
187+
"cpp": "Tree",
188+
"js": "tree"
189189
},
190190
"const git_object *": {
191191
"cpp": "GitObject",
@@ -1733,8 +1733,8 @@
17331733
"js": "initExt"
17341734
},
17351735
"git_repository_init_options *": {
1736-
"js": "RepositoryInitOptions",
1737-
"cpp": "RepositoryInitOptions"
1736+
"cpp": "GitRepositoryInitOptions",
1737+
"js": "RepositoryInitOptions"
17381738
},
17391739
"git_repository_head": {
17401740
"cpp": "Head",
@@ -3081,28 +3081,28 @@
30813081
"js": "Checkout"
30823082
},
30833083
"git_checkout_head *": {
3084-
"cpp": "CheckoutHead",
3085-
"js": "checkoutHead"
3084+
"cpp": "Head",
3085+
"js": "head"
30863086
},
30873087
"const git_checkout_head *": {
3088-
"cpp": "CheckoutHead",
3089-
"js": "checkoutHead"
3088+
"cpp": "Head",
3089+
"js": "head"
30903090
},
30913091
"git_checkout_index *": {
3092-
"cpp": "CheckoutIndex",
3093-
"js": "checkoutIndex"
3092+
"cpp": "Index",
3093+
"js": "index"
30943094
},
30953095
"const git_checkout_index *": {
3096-
"cpp": "CheckoutIndex",
3097-
"js": "checkoutIndex"
3096+
"cpp": "Index",
3097+
"js": "index"
30983098
},
30993099
"git_checkout_tree *": {
3100-
"cpp": "CheckoutTree",
3101-
"js": "checkoutTree"
3100+
"cpp": "Tree",
3101+
"js": "tree"
31023102
},
31033103
"const git_checkout_tree *": {
3104-
"cpp": "CheckoutTree",
3105-
"js": "checkoutTree"
3104+
"cpp": "Tree",
3105+
"js": "tree"
31063106
},
31073107
"git_clone **": {
31083108
"cpp": "GitClone",
@@ -3365,7 +3365,6 @@
33653365
"js": "Config"
33663366
},
33673367
"const git_config **": {
3368-
"cpp": "GitConfig",
33693368
"js": "Config"
33703369
},
33713370
"git_config_find_global *": {
@@ -9067,5 +9066,85 @@
90679066
"const git_remote_delete *": {
90689067
"cpp": "Delete",
90699068
"js": "delete"
9069+
},
9070+
"git_checkout_options": {
9071+
"cpp": "GitCheckoutOptions",
9072+
"js": "CheckoutOptions"
9073+
},
9074+
"git_checkout_options **": {
9075+
"cpp": "GitCheckoutOptions",
9076+
"js": "CheckoutOptions"
9077+
},
9078+
"git_checkout_options *": {
9079+
"cpp": "GitCheckoutOptions",
9080+
"js": "CheckoutOptions"
9081+
},
9082+
"const git_checkout_options **": {
9083+
"cpp": "GitCheckoutOptions",
9084+
"js": "CheckoutOptions"
9085+
},
9086+
"const git_checkout_options *": {
9087+
"cpp": "GitCheckoutOptions",
9088+
"js": "CheckoutOptions"
9089+
},
9090+
"git_cherry": {
9091+
"cpp": "GitCherry",
9092+
"js": "Cherry"
9093+
},
9094+
"git_cherry **": {
9095+
"cpp": "GitCherry",
9096+
"js": "Cherry"
9097+
},
9098+
"git_cherry *": {
9099+
"cpp": "GitCherry",
9100+
"js": "Cherry"
9101+
},
9102+
"const git_cherry **": {
9103+
"cpp": "GitCherry",
9104+
"js": "Cherry"
9105+
},
9106+
"const git_cherry *": {
9107+
"cpp": "GitCherry",
9108+
"js": "Cherry"
9109+
},
9110+
"git_checkout_init_options": {
9111+
"cpp": "InitOptions",
9112+
"js": "initOptions"
9113+
},
9114+
"git_checkout_init_options *": {
9115+
"cpp": "InitOptions",
9116+
"js": "initOptions"
9117+
},
9118+
"const git_checkout_init_options *": {
9119+
"cpp": "InitOptions",
9120+
"js": "initOptions"
9121+
},
9122+
"git_repository_init_options": {
9123+
"cpp": "GitRepositoryInitOptions",
9124+
"js": "RepositoryInitOptions"
9125+
},
9126+
"git_repository_init_options **": {
9127+
"cpp": "GitRepositoryInitOptions",
9128+
"js": "RepositoryInitOptions"
9129+
},
9130+
"const git_repository_init_options **": {
9131+
"cpp": "GitRepositoryInitOptions",
9132+
"js": "RepositoryInitOptions"
9133+
},
9134+
"const git_repository_init_options *": {
9135+
"cpp": "GitRepositoryInitOptions",
9136+
"js": "RepositoryInitOptions"
9137+
},
9138+
"git_repository_init_init_options": {
9139+
"cpp": "InitInitOptions",
9140+
"js": "initInitOptions"
9141+
},
9142+
"git_repository_init_init_options *": {
9143+
"cpp": "InitInitOptions",
9144+
"js": "initInitOptions"
9145+
},
9146+
"const git_repository_init_init_options *": {
9147+
"cpp": "InitInitOptions",
9148+
"js": "initInitOptions"
90709149
}
9071-
}
9150+
}

lib/checkout.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var NodeGit = require("../");
2+
3+
var Checkout = NodeGit.Checkout;
4+
5+
module.exports = Checkout;

lib/nodegit.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,23 @@ descriptors.forEach(function(descriptor) {
3939
exports.__proto__ = rawApi;
4040

4141
// Import extensions
42-
require("./commit.js");
43-
require("./diff.js");
44-
require("./blob.js");
45-
require("./object.js");
46-
require("./signature.js");
47-
require("./odb.js");
48-
require("./oid.js");
49-
require("./index.js");
50-
require("./repository.js");
51-
require("./refs.js");
52-
require("./revwalk.js");
53-
require("./tree.js");
42+
require("./attr");
43+
require("./blob");
44+
require("./checkout");
45+
require("./commit");
46+
require("./diff");
47+
require("./index");
48+
require("./object");
49+
require("./odb");
50+
require("./oid");
51+
require("./patch");
52+
require("./refs");
53+
require("./remote");
54+
require("./repository");
55+
require("./revwalk");
56+
require("./signature");
57+
require("./tree");
58+
require("./tree_entry");
5459

5560
// Wrap asynchronous methods to return promises.
5661
promisify(exports);

test/tests/checkout.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var path = require("path");
2+
3+
describe("Checkout", function() {
4+
var reposPath = path.resolve("test/repos/workdir/.git");
5+
6+
var Repository = require("../../lib/repository");
7+
8+
before(function() {
9+
var test = this;
10+
11+
return Repository.open(reposPath).then(function(repository) {
12+
test.repository = repository;
13+
});
14+
});
15+
});

0 commit comments

Comments
 (0)