Skip to content

Commit

Permalink
fixed tags for gitGraph
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Fulbright authored and Austin Fulbright committed Jul 27, 2024
1 parent 1af9094 commit a386bd0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/mermaid/src/diagrams/git/gitGraphAst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export const merge = (
export const cherryPick = function (
sourceId: string,
targetId: string,
tags: string[],
tags: string[] | undefined,
parentCommitId: string
) {
log.debug('Entering cherryPick:', sourceId, targetId, tags);
Expand Down
7 changes: 4 additions & 3 deletions packages/mermaid/src/diagrams/git/gitGraphParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ const parseStatement = (statement: any) => {
const parseCommit = (commit: CommitAst) => {
const id = commit.id;
const message = commit.message ?? '';
const tags = commit.tags ?? [];
const tags = commit.tags ?? undefined;
const type = commit.type !== undefined ? commitType[commit.type] : 0;
log.info(`Commit: ${id} ${message} ${type}`);
db.commit(message, id, type, tags);
};

Expand All @@ -59,7 +60,7 @@ const parseBranch = (branch: BranchAst) => {
const parseMerge = (merge: MergeAst) => {
const branch = merge.branch;
const id = merge.id ?? '';
const tags = merge.tags ?? [];
const tags = merge.tags ?? undefined;
const type = merge.type !== undefined ? commitType[merge.type] : 0;
db.merge(branch, id, type, tags);
};
Expand All @@ -71,7 +72,7 @@ const parseCheckout = (checkout: CheckoutAst) => {

const parseCherryPicking = (cherryPicking: CherryPickingAst) => {
const id = cherryPicking.id;
const tags = cherryPicking.tags ?? [];
const tags = cherryPicking.tags ?? undefined;
const parent = cherryPicking.parent;
db.cherryPick(id, '', tags, parent);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/mermaid/src/diagrams/git/gitGraphTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface Commit {
message: string;
seq: number;
type: number;
tags: string[] | undefined;
tags: string[];
parents: (string | null)[];
branch: string;
customType?: number;
Expand Down
7 changes: 3 additions & 4 deletions packages/parser/src/language/gitGraph/gitGraph.langium
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Statement
| CherryPicking
;


Direction:
dir=('LR' | 'TB' | 'BT');

Expand All @@ -57,7 +56,7 @@ Commit:
(
'id:' id=STRING
|'msg:'? message=STRING
|'tag:' tags=STRING
|'tag:' tags+=STRING
|'type:' name=('NORMAL' | 'REVERSE' | 'HIGHLIGHT')
)* EOL;
Branch:
Expand All @@ -69,7 +68,7 @@ Merge:
'merge' branch=(ID|STRING)
(
'id:' id=STRING
|'tag:' tags=STRING
|'tag:' tags+=STRING
|'type:' name=('NORMAL' | 'REVERSE' | 'HIGHLIGHT')
)* EOL;

Expand All @@ -80,7 +79,7 @@ CherryPicking:
'cherry-pick'
(
'id:' id=STRING
|'tag:' tags=STRING
|'tag:' tags+=STRING
|'parent:' id=STRING
)* EOL;

Expand Down

0 comments on commit a386bd0

Please sign in to comment.