Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
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
17 changes: 12 additions & 5 deletions 17 lib/repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,23 +725,25 @@ Repository.prototype.fetchAll = function(
});
};


/**
* Merge a branch onto another branch
*
* @param {String|Ref} to
* @param {String|Ref} from
* @param {Signature} signature
* @param {Merge.PREFERENCE} mergePreference
* @param {MergeOptions} mergeOptions
* @return {Oid|Index} A commit id for a succesful merge or an index for a
* merge with conflicts
*/
Repository.prototype.mergeBranches =
function(to, from, signature, mergePreference) {
function(to, from, signature, mergePreference, mergeOptions) {
var repo = this;
var fromBranch;
var toBranch;

mergePreference = mergePreference || NodeGit.Merge.PREFERENCE.NONE;
mergeOptions = normalizeOptions(mergeOptions, NodeGit.MergeOptions);

signature = signature || repo.defaultSignature();

Expand Down Expand Up @@ -806,7 +808,12 @@ Repository.prototype.mergeBranches =
})
.then(function(headRef) {
updateHead = !!headRef && (headRef.name() === toBranch.name());
return NodeGit.Merge.commits(repo, toCommitOid, fromCommitOid);
return NodeGit.Merge.commits(
repo,
toCommitOid,
fromCommitOid,
mergeOptions
);
})
.then(function(index) {
// if we have conflicts then throw the index
Expand Down Expand Up @@ -834,8 +841,8 @@ Repository.prototype.mergeBranches =
[toCommitOid, fromCommitOid]);
})
.then(function(commit) {
// // we've updated the checked out branch, so make sure we update
// // head so that our index isn't messed up
// we've updated the checked out branch, so make sure we update
// head so that our index isn't messed up
if (updateHead) {
return repo.getBranch(to)
.then(function(branch) {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.