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

Fix freeing a `GitOid` that was passed as a string by johnhaley81 · Pull Request #531 · nodegit/nodegit · GitHub

Repository navigation

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

Filter by extension

Filter by extension .cc  (1) .js  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion generate/templates/partials/sync_function.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ from_{{ arg.name }}
{%each args|argsInfo as arg %}
{%if arg | isOid %}
if (args[{{ arg.jsArg }}]->IsString()) {
free(&from_{{ arg.name }});
free((void *)from_{{ arg.name }});
}
{%endif%}
{%endeach%}
Expand Down
17 changes: 17 additions & 0 deletions test/tests/oid.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
var assert = require("assert");
var path = require("path");
var local = path.join.bind(path, __dirname);

describe("Oid", function() {
var NodeGit = require("../../");
Expand Down Expand Up @@ -26,4 +28,19 @@ describe("Oid", function() {

assert.equal(inspect, "[Oid " + oid + "]");
});

it("can convert strings to oids in parameters", function() {
return NodeGit.Repository.open(local("../repos/workdir"))
.then(function(repo) {
var revwalk = repo.createRevWalk();
revwalk.sorting(NodeGit.Revwalk.SORT.TIME);

revwalk.push(oid);

return revwalk.getCommits(1);
})
.then(function(commits) {
assert.equal(commits[0].toString(), oid);
});
});
});

Back | FazBrowse Home | New Git URL