From 9cbacb01590cf2824da5436ce5d1ab9ac407189d Mon Sep 17 00:00:00 2001 From: Elliot Nelson Date: Sun, 18 Sep 2022 16:25:10 -0400 Subject: [PATCH] Use undefined to mean default tagging behavior --- src/diagrams/git/gitGraphAst.js | 6 +----- src/diagrams/git/parser/gitGraph.jison | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/diagrams/git/gitGraphAst.js b/src/diagrams/git/gitGraphAst.js index 3a6260d4f..41130c780 100644 --- a/src/diagrams/git/gitGraphAst.js +++ b/src/diagrams/git/gitGraphAst.js @@ -262,10 +262,6 @@ export const cherryPick = function (sourceId, targetId, tag) { log.debug('Entering cherryPick:', sourceId, targetId, tag); sourceId = common.sanitizeText(sourceId, configApi.getConfig()); targetId = common.sanitizeText(targetId, configApi.getConfig()); - - if (tag === 'cherry-pick:') { - tag = 'cherry-pick:' + sourceCommit.id; - } tag = common.sanitizeText(tag, configApi.getConfig()); if (!sourceId || typeof commits[sourceId] === 'undefined') { @@ -334,7 +330,7 @@ export const cherryPick = function (sourceId, targetId, tag) { parents: [head == null ? null : head.id, sourceCommit.id], branch: curBranch, type: commitType.CHERRY_PICK, - tag: tag, + tag: tag ?? 'cherry-pick:' + sourceCommit.id, }; head = commit; commits[commit.id] = commit; diff --git a/src/diagrams/git/parser/gitGraph.jison b/src/diagrams/git/parser/gitGraph.jison index 68b6a7af5..74d785f83 100644 --- a/src/diagrams/git/parser/gitGraph.jison +++ b/src/diagrams/git/parser/gitGraph.jison @@ -117,7 +117,7 @@ branchStatement ; cherryPickStatement - : CHERRY_PICK COMMIT_ID STR {yy.cherryPick($3, '', 'cherry-pick:')} + : CHERRY_PICK COMMIT_ID STR {yy.cherryPick($3, '', undefined)} | CHERRY_PICK COMMIT_ID STR COMMIT_TAG STR {yy.cherryPick($3, '', $5)} | CHERRY_PICK COMMIT_TAG STR COMMIT_ID STR {yy.cherryPick($5, '', $3)} ;