Skip to content

Commit 560eb06

Browse files
authored
Merge pull request #1605 from implausible/fix/segfault-on-revert-opts-no-merge-opts
Fix segfault in NodeGit.Revert.revert
2 parents 7ebb3e4 + d99c327 commit 560eb06

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

lib/revert.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Revert.commit = function(
5050
/**
5151
* Reverts the given commit, producing changes in the index and
5252
* working directory.
53-
*
53+
*
5454
* @async
5555
* @param {Repository} repo the repository to perform the revert in
5656
* @param {Commit} commit the commit to revert
@@ -71,7 +71,7 @@ Revert.revert = function(repo, commit, revertOpts) {
7171

7272
revertOpts = normalizeOptions(revertOpts, NodeGit.RevertOptions);
7373

74-
if (revertOpts) {
74+
if (mergeOpts) {
7575
revertOpts.mergeOpts =
7676
normalizeOptions(mergeOpts, NodeGit.MergeOptions);
7777
}

test/tests/revert.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,11 @@ describe("Revert", function() {
7474
throw error;
7575
});
7676
});
77+
78+
it("RevertOptions without MergeOptions should not segfault", function() {
79+
return Revert.revert(test.repository, test.firstCommit, {})
80+
.catch(function(error) {
81+
throw error;
82+
});
83+
});
7784
});

0 commit comments

Comments
 (0)