Skip to content

Commit 7fd6152

Browse files
John Haleymaxkorp
John Haley
authored andcommitted
Changed merge so that you don't have to pass null in for options
1 parent 4c61589 commit 7fd6152

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

example/merge.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fse.remove(path.resolve(__dirname, repoDir))
9191

9292
// Merge the two commits
9393
.then(function() {
94-
return nodegit.Merge.commits(repository, ourCommit, theirCommit, null);
94+
return nodegit.Merge.commits(repository, ourCommit, theirCommit);
9595
})
9696

9797
// Merging returns an index that isn't backed by the repository. You have to write it to the repository,

lib/merge.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
var NodeGit = require("../");
2+
var normalizeOptions = require("./util/normalize_options");
3+
4+
var Merge = NodeGit.Merge;
5+
var mergeCommits = Merge.commits;
6+
7+
/**
8+
* Merge 2 commits together and create an new index that can
9+
* be used to create a merge commit.
10+
*
11+
* @param repo Repository that contains the given commits
12+
* @param ourCommit The commit that reflects the destination tree
13+
* @oaram theirCommit The commit to merge into ourCommit
14+
* @param options The merge tree options (null for default)
15+
*/
16+
Merge.commits = function(repo, ourCommit, theirCommit, options) {
17+
options = normalizeOptions(options, NodeGit.MergeOptions);
18+
19+
return mergeCommits.call(this, repo, ourCommit, theirCommit, options);
20+
};
21+
22+
module.exports = Merge;

lib/nodegit.js

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ require("./checkout");
5050
require("./commit");
5151
require("./diff");
5252
require("./index");
53+
require("./merge");
5354
require("./object");
5455
require("./odb");
5556
require("./odb_object");

0 commit comments

Comments
 (0)