Skip to content

Commit fd9b5f2

Browse files
committed
move oid from forced c++ method to javascript method
1 parent 3f128ea commit fd9b5f2

5 files changed

Lines changed: 8 additions & 12 deletions

File tree

generate/descriptor.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@
604604
"ignore": true
605605
},
606606
"oid": {
607+
"shouldAlloc": true,
607608
"functions": {
608609
"git_oid_cpy": {
609610
"ignore": true
@@ -615,7 +616,8 @@
615616
"ignore": true
616617
},
617618
"git_oid_fromstr": {
618-
"ignore": true
619+
"jsFunctionName": "fromString",
620+
"isAsync": false
619621
},
620622
"git_oid_fromstrn": {
621623
"ignore": true
@@ -639,7 +641,8 @@
639641
"ignore": true
640642
},
641643
"git_oid_tostr": {
642-
"ignore": true
644+
"ignore": true,
645+
"jsFunctionName": "toString"
643646
}
644647
},
645648
"fields": {

generate/partials/async_function.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void {{ cppClassName }}::{{ cppFunctionName }}Worker::Execute() {
5454
{%each args|argsInfo as arg %}
5555
{%-- turn the pointer into a ref --%}
5656
{%if arg.isReturn|and arg.cType|isDoublePointer %}&{%endif%}baton->{{ arg.name }}{%if not arg.lastArg %},{%endif%}
57-
57+
5858
{%endeach%}
5959
);
6060

@@ -113,7 +113,7 @@ void {{ cppClassName }}::{{ cppFunctionName }}Worker::HandleOKCallback() {
113113

114114
{%each args as arg %}
115115
{%if arg.shouldAlloc %}
116-
free(baton->{{ arg.name }});
116+
free((void*)baton->{{ arg.name }});
117117
{%endif%}
118118
{%endeach%}
119119
}

lib/oid.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ Object.defineProperties(Oid.prototype, {
1010
}
1111
});
1212

13-
Object.defineProperties(Oid, {
14-
"fromString": {
15-
value: Oid.fromstr,
16-
enumerable: false
17-
}
18-
});
19-
2013
Oid.prototype.inspect = function() {
2114
return "[Oid " + this.allocfmt() + "]";
2215
};

lib/repository.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ Repository.prototype.getCommit = function(oid, callback) {
115115
*/
116116
Repository.prototype.getBlob = function(oid, callback) {
117117
oid = normalizeOid(oid);
118-
119118
var repository = this;
120119

121120
return Blob.lookup(repository, oid).then(function(blob) {

lib/util/normalize_oid.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ function normalizeOid(oid) {
1111
return typeof oid === "string" ? NodeGit.Oid.fromString(oid) : oid;
1212
}
1313
catch (ex) {
14+
console.log(ex);
1415
return null;
1516
}
1617
}

0 commit comments

Comments
 (0)