FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add `mergeOptions` to `Repository#mergeBranches` by johnhaley81 · Pull Request #873 · nodegit/nodegit · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .js  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
17 changes: 12 additions & 5 deletions lib/repository.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL