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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/revert.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Revert.commit = function(
/**
* Reverts the given commit, producing changes in the index and
* working directory.
*
*
* @async
* @param {Repository} repo the repository to perform the revert in
* @param {Commit} commit the commit to revert
Expand All @@ -71,7 +71,7 @@ Revert.revert = function(repo, commit, revertOpts) {

revertOpts = normalizeOptions(revertOpts, NodeGit.RevertOptions);

if (revertOpts) {
if (mergeOpts) {
revertOpts.mergeOpts =
normalizeOptions(mergeOpts, NodeGit.MergeOptions);
}
Expand Down
7 changes: 7 additions & 0 deletions test/tests/revert.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,11 @@ describe("Revert", function() {
throw error;
});
});

it("RevertOptions without MergeOptions should not segfault", function() {
return Revert.revert(test.repository, test.firstCommit, {})
.catch(function(error) {
throw error;
});
});
});