-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Open
Labels
Graph: GitStatus: ApprovedIs ready to be worked onIs ready to be worked onType: Bug / ErrorSomething isn't working or is incorrectSomething isn't working or is incorrect
Description
Description
I was making a diagram to explain develop->stable branch relationship, but then I discovered if the branch was last updated by the last merged branch and tried to merge the same branch over again (to get the additional commits since the last commits), it fails.
Essentially simulating
# simulate mermaid's "commit" syntax:
alias makeCommit='echo "work" >> work.txt && git add work.txt && git commit -m "commit"'
git switch -C main
makeCommit
git switch -c stable
git merge main --no-ff
git tag v1.0
git switch main
makeCommit
makeCommit
git switch stable
git merge main --no-ff
git tag v1.1
git switch main
makeCommitYou can check git log --graph --all after that to see what kind of a representation i expected.
Steps to reproduce
Checkout the code example.
Screenshots
No response
Code Sample
gitGraph
commit
branch stable
checkout stable
merge main
Setup
- Mermaid version: Develop: v11.12.1+f28f3c2, main mermaid.live: v11.12.0
- Browser and Version: Firefox 144.0.2
Suggested Solutions
Maybe check if the branches are at the same commit at
mermaid/packages/mermaid/src/diagrams/git/gitGraphAst.ts
Lines 170 to 172 in f28f3c2
| if (currentCommit && otherCommit && currentCommit.branch === otherBranch) { | |
| throw new Error(`Cannot merge branch '${otherBranch}' into itself.`); | |
| } |
Additional Context
No response
Metadata
Metadata
Assignees
Labels
Graph: GitStatus: ApprovedIs ready to be worked onIs ready to be worked onType: Bug / ErrorSomething isn't working or is incorrectSomething isn't working or is incorrect