Skip to content

Commit 98c7102

Browse files
committed
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.
1 parent 4611ca7 commit 98c7102

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

generate/input/descriptor.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,6 +2179,11 @@
21792179
],
21802180
"functions": {
21812181
"git_repository_discover": {
2182+
"args": {
2183+
"ceiling_dirs": {
2184+
"isOptional": true
2185+
}
2186+
},
21822187
"isAsync": true,
21832188
"return": {
21842189
"isErrorCode": true

test/tests/repository.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,23 @@ describe("Repository", function() {
200200
});
201201
});
202202

203-
it("can discover if a path is part of a repository", function() {
203+
function discover(ceiling) {
204204
var testPath = path.join(reposPath, "lib", "util", "normalize_oid.js");
205205
var expectedPath = path.join(reposPath, ".git");
206-
return NodeGit.Repository.discover(testPath, 0, "")
206+
return NodeGit.Repository.discover(testPath, 0, ceiling)
207207
.then(function(foundPath) {
208208
assert.equal(expectedPath, foundPath);
209209
});
210+
}
211+
212+
it("can discover if a path is part of a repository, null ceiling",
213+
function() {
214+
return discover(null);
215+
});
216+
217+
it("can discover if a path is part of a repository, empty ceiling",
218+
function() {
219+
return discover("");
210220
});
211221

212222
it("can create a repo using initExt", function() {

0 commit comments

Comments
 (0)