Skip to content

Commit

Permalink
Include logic for gitgraph with unconnected branches
Browse files Browse the repository at this point in the history
  • Loading branch information
mathbraga committed Jan 16, 2024
1 parent 02246f6 commit c77a6e1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/mermaid/src/diagrams/git/gitGraphRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,16 @@ const drawCommits = (svg, commits, modifyGraph) => {
sortedKeys.forEach((key) => {
const commit = commits[key];

if (isParallelCommits && commit.parents.length) {
const closestParent = findClosestParent(commit.parents);
pos = dir === 'TB' ? commitPos[closestParent].y + 40 : commitPos[closestParent].x + 40;
if (isParallelCommits) {
if (!commit.parents.length) {
pos = 0;
if (dir === 'TB') {
pos = 30;
}
} else {
const closestParent = findClosestParent(commit.parents);
pos = dir === 'TB' ? commitPos[closestParent].y + 40 : commitPos[closestParent].x + 40;
}
}

const y = dir === 'TB' ? pos + 10 : branchPos[commit.branch].pos;
Expand Down

0 comments on commit c77a6e1

Please sign in to comment.