Skip to content

Commit 1e57edf

Browse files
author
Ken Price
committed
Test for: undefined pathspec option should not segfault.
1 parent 1967b99 commit 1e57edf

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/tests/diff.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,31 @@ describe("Diff", function() {
274274
});
275275
});
276276

277+
it("can pass undefined pathspec as option to indexToWorkdir", function() {
278+
var test = this;
279+
280+
return Repository.open(reposPath).then(function(repository) {
281+
test.repository = repository;
282+
283+
return repository.openIndex();
284+
})
285+
.then(function(index) {
286+
test.index = index;
287+
288+
return test.repository.getBranchCommit("master");
289+
})
290+
.then(function() {
291+
var opts = {
292+
flags: Diff.OPTION.INCLUDE_UNTRACKED |
293+
Diff.OPTION.RECURSE_UNTRACKED_DIRS,
294+
pathspec: undefined
295+
};
296+
297+
// should not segfault
298+
return Diff.indexToWorkdir(test.repository, test.index, opts);
299+
});
300+
});
301+
277302
// This wasn't working before. It was only passing because the promise chain
278303
// was broken
279304
it.skip("can find similar files in a diff", function() {

0 commit comments

Comments
 (0)