This repository has been archived by the owner on Jul 13, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The steps to reproduce error: var master = gitgraph.branch("master"); master.commit(); var branch0 = master.branch("branch0"); var branch1 = branch0.branch("branch1"); var branch2 = branch0.branch("branch2"); branch1.commit() branch2.commit() The arrow point from branch0 to branch2, branch3 will have vertical directions. The cause: When create a new commit object, it will first check parentBranch has commit or not. If it has commit, it will push a new point to path, so there will have a broken-line to this commit. In the above case, the branch0 has no commit when branch1, 2 commit, so branch1, 2 will have no breakpoint in path, instead the line will straightly draw from master to the commit. The fix: The check of parentCommit is empty or not is actually not needed. We can always draw broken-line by removing the condition. Now every path to commit will have a broken point before it, and the direction of arrow is correct now. Also, it will push a point to parentBranch if parentBranch has commit. The code will generate some error path. For example, in above case, adding a branch0.commit() after branch2.commit() The line will have not breakpoint in path since branch0 has a point in it already when branch1 commit. To be check: I think there will have some problem if we adjust the template spacing. Since the direction of arrow is vertical or not is determined by the relative position of parent commit and current commit. However the direction of path is now always segmented. This acquires more example to check the correctness.
- Loading branch information