Skip to content

Commit

Permalink
GitGraph: simplified overlapping check fn
Browse files Browse the repository at this point in the history
  • Loading branch information
guypursey committed Oct 13, 2023
1 parent f713548 commit 86b296b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/mermaid/src/diagrams/git/gitGraphRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,10 @@ const drawCommits = (svg, commits, modifyGraph) => {
*/
const hasOverlappingCommits = (commitA, commitB, allCommits) => {
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 isTargetMain = (x) => x.branch === getConfig().gitGraph.mainBranchName;
const sourceIsMain = commitA.branch === getConfig().gitGraph.mainBranchName;
return Object.values(allCommits).some((commitX) => {
return (
(isOnSourceBranch(commitX) || (isOnTargetBranch(commitX) && !isTargetMain(commitX))) &&
isBetweenCommits(commitX)
);
return isBetweenCommits(commitX) && (sourceIsMain || isOnSourceBranch(commitX));
});
};

Expand Down

0 comments on commit 86b296b

Please sign in to comment.