From 19e24053dc9c3c1564e565546b296258517a03ff Mon Sep 17 00:00:00 2001 From: Remy Suen Date: Wed, 12 Apr 2017 15:23:15 +0900 Subject: [PATCH] Add JavaScript version of `git_tag_peel()` The git_tag_peel() function from libgit2 naturally takes a pointer as a parameter for providing the caller with the peeled object. However, this kind of API does not make sense in the JavaScript world so we need to change the generated code to return the actual object to the caller. --- generate/input/descriptor.json | 8 ++++++++ test/tests/tag.js | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/generate/input/descriptor.json b/generate/input/descriptor.json index 25a01481d..a236a2c47 100644 --- a/generate/input/descriptor.json +++ b/generate/input/descriptor.json @@ -2696,6 +2696,14 @@ "isErrorCode": true }, "isAsync": true + }, + "git_tag_peel": { + "args": { + "tag_target_out": { + "isReturn": true + } + }, + "isAsync": true } } }, diff --git a/test/tests/tag.js b/test/tests/tag.js index 11b4f566f..55f1d71e4 100644 --- a/test/tests/tag.js +++ b/test/tests/tag.js @@ -220,4 +220,14 @@ describe("Tag", function() { assert(object.type(), Obj.TYPE.TAG); }); }); + + it("can peel a tag", function() { + return this.repository.getTagByName(tagName) + .then(function(tag) { + return tag.peel(); + }) + .then(function(object) { + assert.equal(object.isCommit(), true); + }); + }); });