diff --git a/packages/mermaid/src/diagrams/git/gitGraphAst.ts b/packages/mermaid/src/diagrams/git/gitGraphAst.ts index 53c361e3e..1a40450d9 100644 --- a/packages/mermaid/src/diagrams/git/gitGraphAst.ts +++ b/packages/mermaid/src/diagrams/git/gitGraphAst.ts @@ -213,7 +213,7 @@ export const merge = ( id: customId ? customId : state.records.seq + '-' + getID(), message: `merged branch ${otherBranch} into ${state.records.currBranch}`, seq: state.records.seq++, - parents: [state.records.head == null ? null : state.records.head.id, verifiedBranch], + parents: state.records.head == null ? [] : [state.records.head.id, verifiedBranch], branch: state.records.currBranch, type: commitType.MERGE, customType: overrideType, @@ -317,7 +317,7 @@ export const cherryPick = function ( id: state.records.seq + '-' + getID(), message: `cherry-picked ${sourceCommit?.message} into ${state.records.currBranch}`, seq: state.records.seq++, - parents: [state.records.head == null ? null : state.records.head.id, sourceCommit.id], + parents: state.records.head == null ? [] : [state.records.head.id, sourceCommit.id], branch: state.records.currBranch, type: commitType.CHERRY_PICK, tags: tags diff --git a/packages/mermaid/src/diagrams/git/gitGraphTypes.ts b/packages/mermaid/src/diagrams/git/gitGraphTypes.ts index 0e929666f..b473dd874 100644 --- a/packages/mermaid/src/diagrams/git/gitGraphTypes.ts +++ b/packages/mermaid/src/diagrams/git/gitGraphTypes.ts @@ -15,7 +15,7 @@ export interface Commit { seq: number; type: number; tags: string[]; - parents: (string | null)[]; + parents: string[]; branch: string; customType?: number; customId?: boolean; @@ -109,4 +109,4 @@ export interface GitGraphDB extends DiagramDB { getHead: () => Commit | null; } -export type DiagramOrientation = 'LR' | 'TB'; +export type DiagramOrientation = 'LR' | 'TB' | 'BT';