mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-17 14:29:48 +02:00
GitGraph: simplified overlapping check fn
This commit is contained in:
@@ -353,14 +353,10 @@ const drawCommits = (svg, commits, modifyGraph) => {
|
|||||||
*/
|
*/
|
||||||
const hasOverlappingCommits = (commitA, commitB, allCommits) => {
|
const hasOverlappingCommits = (commitA, commitB, allCommits) => {
|
||||||
const isOnSourceBranch = (x) => x.branch === commitA.branch;
|
const isOnSourceBranch = (x) => x.branch === commitA.branch;
|
||||||
const isOnTargetBranch = (x) => x.branch === commitB.branch;
|
|
||||||
const isBetweenCommits = (x) => x.seq > commitA.seq && x.seq < commitB.seq;
|
const isBetweenCommits = (x) => x.seq > commitA.seq && x.seq < commitB.seq;
|
||||||
const isTargetMain = (x) => x.branch === getConfig().gitGraph.mainBranchName;
|
const sourceIsMain = commitA.branch === getConfig().gitGraph.mainBranchName;
|
||||||
return Object.values(allCommits).some((commitX) => {
|
return Object.values(allCommits).some((commitX) => {
|
||||||
return (
|
return isBetweenCommits(commitX) && (sourceIsMain || isOnSourceBranch(commitX));
|
||||||
(isOnSourceBranch(commitX) || (isOnTargetBranch(commitX) && !isTargetMain(commitX))) &&
|
|
||||||
isBetweenCommits(commitX)
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user