Skip to content

Commit ec0811c

Browse files
committed
Merge pull request nodegit#266 from nodegit/fix-attr-test
voidcheck string pointers and reenable attr test
2 parents 4c519ee + eeb5f77 commit ec0811c

3 files changed

Lines changed: 19 additions & 12 deletions

File tree

generate/descriptor.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
"functions": {
44
"git_attr_foreach": {
55
"ignore": true
6+
},
7+
"git_attr_get": {
8+
"isAsync": true,
9+
"args": {
10+
"value_out": {
11+
"isReturn": true
12+
}
13+
}
614
}
715
}
816
},

generate/partials/convert_to_v8.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
// start convert_to_v8 block
22
{%if cppClassName == 'String' %}
3+
if ({{= parsedName =}}){
34
{%if size %}
4-
to = NanNew<String>({{= parsedName =}}, {{ size }});
5+
to = NanNew<String>({{= parsedName =}}, {{ size }});
56
{%elsif cType == 'char **' %}
6-
to = NanNew<String>(*{{= parsedName =}});
7+
8+
to = NanNew<String>(*{{= parsedName =}});
79
{%else%}
8-
to = NanNew<String>({{= parsedName =}});
10+
to = NanNew<String>({{= parsedName =}});
911
{%endif%}
12+
}
13+
else {
14+
to = NanNull();
15+
}
1016

1117
{%if freeFunctionName %}
1218
{{ freeFunctionName }}({{= parsedName =}});

test/tests/attr.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,8 @@ describe("Attr", function() {
2525
Attr.cacheFlush(this.repository);
2626
});
2727

28-
// FIXME Currently segfaults.
29-
it.skip("can lookup the value of a git attribute", function() {
28+
it("can lookup the value of a git attribute", function() {
3029
var flags = Attr.Check.NO_SYSTEM;
31-
var getAttr = Attr.get(this.repository, flags, ".gitattributes", "test");
32-
33-
return getAttr.then(function(val) {
34-
console.log(val);
35-
}).catch(function(ex) {
36-
console.log(ex);
37-
});
30+
Attr.get(this.repository, flags, ".gitattributes", "test");
3831
});
3932
});

0 commit comments

Comments
 (0)