Skip to content

Commit 493050c

Browse files
author
John Haley
committed
Add git_reset
1 parent 2141be4 commit 493050c

File tree

4 files changed

+91
-25
lines changed

4 files changed

+91
-25
lines changed

generate/input/descriptor.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,12 @@
14151415
},
14161416
"reset": {
14171417
"functions": {
1418+
"git_reset": {
1419+
"isAsync": true,
1420+
"return": {
1421+
"isErrorCode": true
1422+
}
1423+
},
14181424
"git_reset_default": {
14191425
"args": {
14201426
"target": {

generate/input/libgit2-supplement.json

Lines changed: 63 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,64 @@
107107
}
108108
},
109109
"new" : {
110+
"functions": {
111+
"git_reset": {
112+
"type": "function",
113+
"file": "reset.h",
114+
"args": [
115+
{
116+
"name": "repo",
117+
"type": "git_repository *"
118+
},
119+
{
120+
"name": "target",
121+
"type": "git_object *"
122+
},
123+
{
124+
"name": "reset_type",
125+
"type": "git_reset_t"
126+
},
127+
{
128+
"name": "checkout_opts",
129+
"type": "git_checkout_options *"
130+
},
131+
{
132+
"name": "signature",
133+
"type": "const git_signature *"
134+
},
135+
{
136+
"name": "log_message",
137+
"type": "const char *"
138+
}
139+
],
140+
"return": {
141+
"type": "int"
142+
},
143+
"group": "reset"
144+
}
145+
},
146+
"groups": [
147+
[
148+
"odb_object",
149+
[
150+
"git_odb_object_data",
151+
"git_odb_object_dup",
152+
"git_odb_object_free",
153+
"git_odb_object_id",
154+
"git_odb_object_size",
155+
"git_odb_object_type"
156+
]
157+
],
158+
[
159+
"status_list",
160+
[
161+
"git_status_list_entrycount",
162+
"git_status_list_free",
163+
"git_status_list_get_perfdata",
164+
"git_status_list_new"
165+
]
166+
]
167+
],
110168
"types": [
111169
[
112170
"git_direction",
@@ -340,28 +398,6 @@
340398
}
341399
}
342400
]
343-
],
344-
"groups": [
345-
[
346-
"odb_object",
347-
[
348-
"git_odb_object_data",
349-
"git_odb_object_dup",
350-
"git_odb_object_free",
351-
"git_odb_object_id",
352-
"git_odb_object_size",
353-
"git_odb_object_type"
354-
]
355-
],
356-
[
357-
"status_list",
358-
[
359-
"git_status_list_entrycount",
360-
"git_status_list_free",
361-
"git_status_list_get_perfdata",
362-
"git_status_list_new"
363-
]
364-
]
365401
]
366402
},
367403
"remove": {
@@ -392,5 +428,10 @@
392428
"git_status_list_new"
393429
]
394430
}
431+
},
432+
"groups": {
433+
"reset": [
434+
"git_reset"
435+
]
395436
}
396437
}

generate/scripts/generateJson.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,22 @@ var supplement = require("../input/libgit2-supplement.json");
1111
module.exports = function generateJson() {
1212
var helpers = require("./helpers");
1313
_ = require("lodash");
14-
14+
// libgit2's docs aren't complete so we'll add in what they're missing here
1515
libgit2.types.forEach(function(type) {
16-
if (supplement.types[type[0]]){
16+
if (supplement.types[type[0]]) {
1717
_.merge(type[1], supplement.types[type[0]]);
1818
}
1919
});
2020

21-
// libgit2's docs aren't complete so we'll add in what they're missing here
21+
libgit2.groups.forEach(function(group) {
22+
if (supplement.groups[group[0]]) {
23+
Array.prototype.push.apply(group[1], supplement.groups[group[0]]);
24+
}
25+
});
26+
2227
Array.prototype.push.apply(libgit2.types, supplement.new.types);
2328
Array.prototype.push.apply(libgit2.groups, supplement.new.groups);
29+
_.merge(libgit2.functions, supplement.new.functions);
2430

2531
var output = [];
2632
var dependencyLookup = {};

lib/reset.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,17 @@ Reset.default = function(repo, target, pathspecs) {
88
return defaultFn.call(this, repo, target, pathspecs);
99
};
1010

11+
var reset = Reset.reset;
12+
Reset.reset = function(target, resetType, checkoutOpts, signature, logMessage) {
13+
checkoutOpts = normalizeOptions(checkoutOpts, NodeGit.CheckoutOptions);
14+
15+
return reset.call(
16+
this,
17+
target,
18+
resetType,
19+
checkoutOpts,
20+
signature,
21+
logMessage);
22+
};
23+
1124
module.exports = Reset;

0 commit comments

Comments
 (0)