From 0f53a5199adc7ec0a326d56b7d625e6f5f12c884 Mon Sep 17 00:00:00 2001 From: Remy Suen Date: Thu, 21 Dec 2017 07:20:43 +0900 Subject: [PATCH] `ceiling_dirs` parameter in `Repository.discover` is optional libgit2's git_repository_discover function's ceiling_dirs parameter can be null. Flag the parameter as such in the JSON file so that the NodeGit wrapper API behaves the same way. Signed-off-by: Remy Suen --- generate/input/descriptor.json | 3 +++ test/tests/repository.js | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/generate/input/descriptor.json b/generate/input/descriptor.json index 54d611ac0..6457b6cab 100644 --- a/generate/input/descriptor.json +++ b/generate/input/descriptor.json @@ -2245,6 +2245,9 @@ "isErrorCode": true }, "args": { + "ceiling_dirs": { + "isOptional": true + }, "out": { "isReturn": true, "isSelf": false, diff --git a/test/tests/repository.js b/test/tests/repository.js index be165b303..114c890be 100644 --- a/test/tests/repository.js +++ b/test/tests/repository.js @@ -200,13 +200,23 @@ describe("Repository", function() { }); }); - it("can discover if a path is part of a repository", function() { + function discover(ceiling) { var testPath = path.join(reposPath, "lib", "util", "normalize_oid.js"); var expectedPath = path.join(reposPath, ".git"); - return NodeGit.Repository.discover(testPath, 0, "") + return NodeGit.Repository.discover(testPath, 0, ceiling) .then(function(foundPath) { assert.equal(expectedPath, foundPath); }); + } + + it("can discover if a path is part of a repository, null ceiling", + function() { + return discover(null); + }); + + it("can discover if a path is part of a repository, empty ceiling", + function() { + return discover(""); }); it("can create a repo using initExt", function() {