Closed SomnaW closed 7 months ago
Seconding this issue. The following code can be used to test it:
%%{
init: {
'theme': 'base',
'gitGraph': {
'showCommitLabel': false,
'mainBranchName': 'HEAD'
}
}
}%%
gitGraph:
commit
commit
branch feature
commit
checkout HEAD
commit
This corresponds to the following diagram:
%%{
init: {
'theme': 'base',
'gitGraph': {
'showCommitLabel': false,
'mainBranchName': 'HEAD'
}
}
}%%
gitGraph:
commit
commit
branch feature
commit
checkout HEAD
commit
In VSCode the following message appears:
Trying to checkout branch which is not yet created. (Help try using "branch HEAD")
If we try creating the branch (with branch HEAD
), it gives the error message that HEAD
already exists
TLDR: Maybe it is Mermaid version problem. Try update Mermaid to latest Mermaid (10.6.0)
Did some digging around. Hope the following info will help find the bug:
vscode-markdown-mermaid
and crossnote
When I use another markdown extension supporting Mermaid called "Markdown Preview Enhanced" link instead of vscode-markdown-mermaid
, the GitGraph mainBranchName
described above can be renamed and rendered correctly.
This "Markdown Preview Enhanced" seems to have dependency on another project of the same author, called "crossnote" link, which depends on mermaid
. On October 26th, 2023, "crossnote" is claimed to be updated to use Mermaid 10.6.0 instead of 10.4.0 (which this extension is currently using). Therefore this could be just be a Mermaid version issue.
If Mermaid version is not the problem, comparing this extension with "Markdown Preview Enhanced" or "crossnote" could be helpful in identifying the bug.
mermaid
.I also took a look at Issue #1313 at mermaid-live-editor
and Issue #4141 at mermaid
, which reported similar problems in Mermaid live editor. In this comment published on October 4th, author posted a screenshot of this problem in Mermaid live editor showing "Mermaid 10.1.0". I can't reproduce these 2 problems in Mermaid 10.5.0 live editor. Therefore this also suggests that this problem could just be a Mermaid version issue.
Seems to be fixed in v1.21.0 of this extension which picked up a new mermaid version
When the main branch is renamed in a gitgraph type diagram, then attempting to checkout the new name or the default name (main) results in an error that the branch doesn't exist. The renamed branch and commits on the default branch before any branching do show up in the diagram correctly.