Skip to content

Commit

Permalink
Support --no-ff
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Ginnivan authored and JakeGinnivan committed Feb 14, 2015
1 parent 5320480 commit fc69b17
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion js/controlbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,18 @@ define(['d3'], function () {
},

merge: function (args) {
var noFF = false;
if (args.length == 2)
{
var mergeSwitch = args.pop();
if (mergeSwitch === '--no-ff') {
noFF = true;
} else {
this.info('This demo only supports the --no-ff switch..');
}
}
var ref = args.shift(),
result = this.historyView.merge(ref);
result = this.historyView.merge(ref, noFF);

if (result === 'Fast-Forward') {
this.info('You have performed a fast-forward merge.');
Expand Down
4 changes: 2 additions & 2 deletions js/historyview.js
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ define(['d3'], function () {
}
},

merge: function (ref) {
merge: function (ref, noFF) {
var mergeTarget = this.getCommit(ref),
currentCommit = this.getCommit('HEAD');

Expand All @@ -951,7 +951,7 @@ define(['d3'], function () {
throw new Error('Already up-to-date.');
} else if (currentCommit.parent2 === mergeTarget.id) {
throw new Error('Already up-to-date.');
} else if (this.isAncestor(currentCommit, mergeTarget)) {
} else if (this.isAncestor(currentCommit, mergeTarget) && noFF !== true) {
this.fastForward(mergeTarget);
return 'Fast-Forward';
} else {
Expand Down

0 comments on commit fc69b17

Please sign in to comment.