Skip to content

Commit 14a9d40

Browse files
committed
Made no-ff look nice in graph
1 parent fc69b17 commit 14a9d40

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

js/historyview.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ define(['d3'], function () {
9292
}
9393

9494
branchIndex = branches.indexOf(commit.id);
95+
96+
if (commit.isNoFFBranch === true) {
97+
branchIndex++;
98+
}
99+
if (commit.isNoFFCommit === true) {
100+
branchIndex--;
101+
}
95102

96103
if (parentCY === baseLine) {
97104
var direction = 1;
@@ -951,7 +958,16 @@ define(['d3'], function () {
951958
throw new Error('Already up-to-date.');
952959
} else if (currentCommit.parent2 === mergeTarget.id) {
953960
throw new Error('Already up-to-date.');
954-
} else if (this.isAncestor(currentCommit, mergeTarget) && noFF !== true) {
961+
} else if (noFF === true) {
962+
var branchStartCommit = this.getCommit(mergeTarget.parent);
963+
while (branchStartCommit.parent !== currentCommit.id) {
964+
branchStartCommit = this.getCommit(branchStartCommit.parent);
965+
}
966+
967+
branchStartCommit.isNoFFBranch = true;
968+
969+
this.commit({parent2: mergeTarget.id, isNoFFCommit: true});
970+
} else if (this.isAncestor(currentCommit, mergeTarget)) {
955971
this.fastForward(mergeTarget);
956972
return 'Fast-Forward';
957973
} else {

0 commit comments

Comments
 (0)