mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-16 13:59:54 +02:00
fix bug in tracking parent commits
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
var crypto = require("crypto");
|
var crypto = require("crypto");
|
||||||
var Logger = require('../../logger');
|
var Logger = require('../../logger');
|
||||||
var log = new Logger.Log();
|
|
||||||
var _ = require("lodash");
|
var _ = require("lodash");
|
||||||
|
|
||||||
|
var log = new Logger.Log();
|
||||||
//var log = new Logger.Log(1);
|
//var log = new Logger.Log(1);
|
||||||
|
|
||||||
|
|
||||||
@@ -18,17 +19,14 @@ function getId() {
|
|||||||
|
|
||||||
|
|
||||||
function isfastforwardable(currentCommit, otherCommit) {
|
function isfastforwardable(currentCommit, otherCommit) {
|
||||||
var currentSeq = currentCommit.seq;
|
log.debug("Entering isfastforwardable:", currentCommit.id, otherCommit.id);
|
||||||
var otherSeq = otherCommit.seq;
|
while (currentCommit.seq <= otherCommit.seq && currentCommit != otherCommit) {
|
||||||
|
|
||||||
log.debug(commits);
|
|
||||||
log.debug(currentCommit, otherCommit);
|
|
||||||
while (currentSeq <= otherSeq && currentCommit != otherCommit) {
|
|
||||||
// only if other branch has more commits
|
// only if other branch has more commits
|
||||||
if (otherCommit.parent == null) break;
|
if (otherCommit.parent == null) break;
|
||||||
if (Array.isArray(otherCommit.parent)){
|
if (Array.isArray(otherCommit.parent)){
|
||||||
return isfastforwardable(currentCommit, otherCommit.parent[0]) ||
|
log.debug("In merge commit:", otherCommit.parent);
|
||||||
isfastforwardable(currentCommit, otherCommit.parent[1])
|
return isfastforwardable(currentCommit, commits[otherCommit.parent[0]]) ||
|
||||||
|
isfastforwardable(currentCommit, commits[otherCommit.parent[1]])
|
||||||
} else {
|
} else {
|
||||||
otherCommit = commits[otherCommit.parent];
|
otherCommit = commits[otherCommit.parent];
|
||||||
}
|
}
|
||||||
@@ -80,7 +78,7 @@ exports.merge = function(otherBranch) {
|
|||||||
id: getId(),
|
id: getId(),
|
||||||
message: 'merged branch ' + otherBranch + ' into ' + curBranch,
|
message: 'merged branch ' + otherBranch + ' into ' + curBranch,
|
||||||
seq: seq++,
|
seq: seq++,
|
||||||
parent: [head == null ? null : head.id, commits[branches[otherBranch]]]
|
parent: [head == null ? null : head.id, branches[otherBranch]]
|
||||||
};
|
};
|
||||||
head = commit;
|
head = commit;
|
||||||
commits[commit.id] = commit;
|
commits[commit.id] = commit;
|
||||||
|
Reference in New Issue
Block a user