mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-20 15:59:51 +02:00
GitGraph: Correct commit variable in overlap check.
Originally, the function was checking if any commits were on the same branch as `commit2`, the destination commit. However, in order to avoid a conflict, we should only need to check whether any commits are on the same branch as `commit 1`. Updated and moved commenting as well.
This commit is contained in:
@@ -347,11 +347,13 @@ const drawCommits = (svg, commits, modifyGraph) => {
|
||||
* @returns {boolean} If there are commits between commit1's x-position and commit2's x-position
|
||||
*/
|
||||
const hasOverlappingCommits = (commit1, commit2, allCommits) => {
|
||||
// Find commits on the same branch as commit2
|
||||
const keys = Object.keys(allCommits);
|
||||
const overlappingComits = keys.filter((key) => {
|
||||
return (
|
||||
allCommits[key].branch === commit2.branch &&
|
||||
// Find commits on the same branch as commit1,
|
||||
// after commit1 but before commit2
|
||||
// to avoid collision
|
||||
allCommits[key].branch === commit1.branch &&
|
||||
allCommits[key].seq > commit1.seq &&
|
||||
allCommits[key].seq < commit2.seq
|
||||
);
|
||||
|
Reference in New Issue
Block a user