From 275dbe9b2edf29504d240afce7adfb3612961d19 Mon Sep 17 00:00:00 2001 From: Austin Fulbright Date: Sat, 27 Jul 2024 02:02:12 -0400 Subject: [PATCH] fixed all rendering differences --- packages/mermaid/src/diagrams/git/gitGraphAst.ts | 2 ++ packages/mermaid/src/diagrams/git/gitGraphParser.ts | 2 +- packages/parser/src/language/gitGraph/gitGraph.langium | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/mermaid/src/diagrams/git/gitGraphAst.ts b/packages/mermaid/src/diagrams/git/gitGraphAst.ts index 23cd20d805..f31689452e 100644 --- a/packages/mermaid/src/diagrams/git/gitGraphAst.ts +++ b/packages/mermaid/src/diagrams/git/gitGraphAst.ts @@ -287,6 +287,7 @@ export const cherryPick = function ( targetId = common.sanitizeText(targetId, getConfig()); const config = getConfig(); tags = tags?.map((tag) => common.sanitizeText(tag, config)); + parentCommitId = common.sanitizeText(parentCommitId, getConfig()); if (!sourceId || !state.records.commits.has(sourceId)) { @@ -383,6 +384,7 @@ export const cherryPick = function ( }`, ], }; + state.records.head = commit; state.records.commits.set(commit.id, commit); state.records.branches.set(state.records.currBranch, commit.id); diff --git a/packages/mermaid/src/diagrams/git/gitGraphParser.ts b/packages/mermaid/src/diagrams/git/gitGraphParser.ts index 9ef5ae0630..9a5cbcb2bd 100644 --- a/packages/mermaid/src/diagrams/git/gitGraphParser.ts +++ b/packages/mermaid/src/diagrams/git/gitGraphParser.ts @@ -76,7 +76,7 @@ const parseCheckout = (checkout: CheckoutAst) => { const parseCherryPicking = (cherryPicking: CherryPickingAst) => { const id = cherryPicking.id; - const tags = cherryPicking.tags ?? undefined; + const tags = cherryPicking.tags?.length === 0 ? undefined : cherryPicking.tags; const parent = cherryPicking.parent; db.cherryPick(id, '', tags, parent); }; diff --git a/packages/parser/src/language/gitGraph/gitGraph.langium b/packages/parser/src/language/gitGraph/gitGraph.langium index 176e6ee7ef..807f9382b7 100644 --- a/packages/parser/src/language/gitGraph/gitGraph.langium +++ b/packages/parser/src/language/gitGraph/gitGraph.langium @@ -65,7 +65,7 @@ Merge: ( 'id:' id=STRING |'tag:' tags+=STRING - |'type:' name=('NORMAL' | 'REVERSE' | 'HIGHLIGHT') + |'type:' type=('NORMAL' | 'REVERSE' | 'HIGHLIGHT') )* EOL; Checkout: @@ -76,7 +76,7 @@ CherryPicking: ( 'id:' id=STRING |'tag:' tags+=STRING - |'parent:' id=STRING + |'parent:' parent=STRING )* EOL;