FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Expose a proper JavaScript API for TreeEntry's `toObject` · kustomzone/nodegit@ce2f4e3 · GitHub

Repository navigation

Commit ce2f4e3

Browse files
committed
Expose a proper JavaScript API for TreeEntry's toObject
libgit2's git_tree_entry_to_object(*) function takes a pointer to return a git_object back to the caller. We should remove this in the generated code so that the concept of a pointer is not brought over to the JavaScript API.
1 parent d847093 commit ce2f4e3

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

‎generate/input/descriptor.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2590,6 +2590,17 @@
25902590
"return": {
25912591
"ownedByThis": true
25922592
}
2593+
},
2594+
"git_tree_entry_to_object": {
2595+
"args": {
2596+
"object_out": {
2597+
"isReturn": true
2598+
}
2599+
},
2600+
"return": {
2601+
"isErrorCode": true
2602+
},
2603+
"isAsync": true
25932604
}
25942605
}
25952606
},

‎test/tests/tree_entry.js‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,28 @@ describe("TreeEntry", function() {
156156
});
157157
});
158158

159+
it("can convert entry into a blob", function() {
160+
var repo = this.repository;
161+
return this.commit.getEntry("README.md")
162+
.then(function(entry) {
163+
return entry.toObject(repo);
164+
})
165+
.then(function(object) {
166+
assert.equal(object.isBlob(), true);
167+
});
168+
});
169+
170+
it("can convert entry into a tree", function() {
171+
var repo = this.repository;
172+
return this.commit.getEntry("example")
173+
.then(function(entry) {
174+
return entry.toObject(repo);
175+
})
176+
.then(function(object) {
177+
assert.equal(object.isTree(), true);
178+
});
179+
});
180+
159181
it("does not leak", function() {
160182
var test = this;
161183

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL