From bd8c288c58892a1ce721478cf4c96e8aec007439 Mon Sep 17 00:00:00 2001 From: Ian Lee Date: Sat, 8 Jul 2017 22:47:36 -0700 Subject: [PATCH 1/2] WIP: #83 add support for --no-ff with few commits --- js/historyview.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/historyview.js b/js/historyview.js index d62b44f..66cf97e 100644 --- a/js/historyview.js +++ b/js/historyview.js @@ -1416,8 +1416,13 @@ define(['d3'], function() { throw new Error('Already up-to-date.'); } else if (noFF === true) { var branchStartCommit = this.getCommit(mergeTarget.parent); - while (branchStartCommit.parent !== currentCommit.id) { - branchStartCommit = this.getCommit(branchStartCommit.parent); + console.dir(currentCommit); + console.dir(branchStartCommit); + if (branchStartCommit !== currentCommit) { + while (branchStartCommit.parent !== currentCommit.id) { + branchStartCommit = this.getCommit(branchStartCommit.parent); + console.dir(branchStartCommit); + } } branchStartCommit.isNoFFBranch = true; From 8790c69bb011b19f98e9b407db2d40431aeb6d98 Mon Sep 17 00:00:00 2001 From: Ian Lee Date: Sat, 8 Jul 2017 22:56:12 -0700 Subject: [PATCH 2/2] Fixes the new case, but breaks the normal --no-ff functionality where to branches are not able to fast forward anyways --- js/historyview.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/historyview.js b/js/historyview.js index 66cf97e..a19f493 100644 --- a/js/historyview.js +++ b/js/historyview.js @@ -1425,11 +1425,12 @@ define(['d3'], function() { } } - branchStartCommit.isNoFFBranch = true; + branchStartCommit.isNoFFBranch = false; + console.dir(mergeTarget); this.commit({ parent2: mergeTarget.id, - isNoFFCommit: true + // isNoFFCommit: true }, 'Merge'); } else if (this.isAncestorOf(currentCommit.id, mergeTarget.id)) { this.fastForward(mergeTarget);