Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 89 additions & 1 deletion generate/descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,37 @@
},

"blame": {
"cType": "git_blame",
"forwardDeclare": true,

"functions": {
"git_blame_init_options": {
"ignore": false
},

"git_blame_get_hunk_count": {
"ignore": false,
"args": [{ "shouldAlloc": true }]
},

"git_blame_get_hunk_byindex": {
"ignore": false,
"args": [{ "shouldAlloc": true }]
},

"git_blame_get_hunk_byline": {
"ignore": false,
"args": [{ "shouldAlloc": true }]
},

"git_blame_file": {
"ignore": false
},

"git_blame_buffer": {
"ignore": false
}
}
},

"blob": {
Expand Down Expand Up @@ -85,7 +116,64 @@
},

"branch": {
"cType": null
"cType": "git_reference",
"altType": "git_branch",

"dependencies": [
"../include/wrapper.h",
"../include/commit.h",
"../include/refs.h",
"node_buffer.h"
],

"functions": {
"git_branch_create": {
"ignore": false,
"isConstructorMethod": true
},

"git_branch_delete": {
"ignore": false
},

"git_branch_is_head": {
"ignore": false
},

"git_branch_iterator_free": {
"ignore": true
},

"git_branch_iterator_new": {
"ignore": true
},

"git_branch_lookup": {
"ignore": false,
"isConstructorMethod": true,
"args": [{}, {}, {}, { "isSelf": false }]
},

"git_branch_move": {
"ignore": false
},

"git_branch_name": {
"ignore": false
},

"git_branch_next": {
"ignore": true
},

"git_branch_set_upstream": {
"ignore": false
},

"git_branch_upstream": {
"ignore": false
}
}
},

"buffer": {
Expand Down
4 changes: 4 additions & 0 deletions generate/filters/cpp_to_v8.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
var isV8Value = require("./is_v8_value");

module.exports = function(cppClassName) {
if (cppClassName === "Integer") {
cppClassName = "Number";
}

return isV8Value(cppClassName) ? cppClassName : "Object";
};
8 changes: 4 additions & 4 deletions generate/partials/convert_from_v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

if (args[{{ jsArg }}]->Is{{ cppClassName|cppToV8 }}()) {
{%endif%}
{%if cppClassName == 'String' %}
{%if cppClassName == 'String'%}

String::Utf8Value {{ name }}(args[{{ jsArg }}]->ToString());
from_{{ name }} = ({{ cType }}) strdup(*{{ name }});
{%elsif cppClassName == 'Array' %}
{%elsif cppClassName == 'Array'%}

Array *tmp_{{ name }} = Array::Cast(*args[{{ jsArg }}]);
from_{{ name }} = ({{ cType }})malloc(tmp_{{ name }}->Length() * sizeof({{ cType|replace '**' '*' }}));
Expand All @@ -18,8 +18,8 @@
--%}
from_{{ name }}[i] = ObjectWrap::Unwrap<{{ arrayElementCppClassName }}>(tmp_{{ name }}->Get(NanNew<Number>(static_cast<double>(i)))->ToObject())->GetValue();
}
{%elsif cppClassName == 'Function' %}
{%elsif cppClassName == 'Buffer' %}
{%elsif cppClassName == 'Function'%}
{%elsif cppClassName == 'Buffer'%}

from_{{ name }} = Buffer::Data(args[{{ jsArg }}]->ToObject());
{%elsif cppClassName|isV8Value %}
Expand Down
20 changes: 10 additions & 10 deletions generate/partials/doc.cc
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/**
{%each args as arg %}
{%if not arg.isReturn %}
{%if not arg.isSelf %}
{%each args as arg %}
{%if not arg.isReturn %}
{%if not arg.isSelf %}
* @param {{ arg.jsClassName }} {{ arg.name }}
{%endif%}
{%endif%}
{%endeach%}{%each .|returnsInfo as returnInfo %}
{%if isAsync %}
{%endif%}
{%endif%}
{%endeach%}{%each .|returnsInfo as returnInfo %}
{%if isAsync %}
* @param {{ returnInfo.jsOrCppClassName }} callback
{%else%}
{%else%}
* @return {{ returnInfo.jsOrCppClassName }} {%if returnInfo.name %}{{ returnInfo.name }}{%else%}result{%endif%}
{%endif%}
{%endeach%}
{%endif%}
{%endeach%}
*/
2 changes: 1 addition & 1 deletion generate/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ fileNames.forEach(function(fileName, index) {

var funcDescriptor = libgit2.functions[functionName];
var descriptor = {};
var cType = file.cType || "git_" + file.filename.slice(0, -2);
var cType = file.altType || file.cType || "git_" + file.filename.slice(0, -2);

// From the hand maintained file.
var functionDescriptor = functions ? functions[functionName] || ident : ident;
Expand Down
2 changes: 1 addition & 1 deletion generate/templates/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
}
]
]
},
}
]
}
2 changes: 1 addition & 1 deletion generate/templates/class_content.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This is a generated file, modify: generate/templates/class.cc.
// This is a generated file, modify: generate/templates/class_content.cc.
#include <nan.h>
#include <string.h>

Expand Down
2 changes: 1 addition & 1 deletion generate/templates/struct_content.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This is a generated file, modify: generate/templates/class.cc.
// This is a generated file, modify: generate/templates/struct_content.cc.
#include <nan.h>
#include <string.h>
#include <chrono>
Expand Down
Loading