Use undefined to mean default tagging behavior

This commit is contained in:
Elliot Nelson
2022-09-18 16:25:10 -04:00
parent f37ac53118
commit 9cbacb0159
2 changed files with 2 additions and 6 deletions

View File

@@ -262,10 +262,6 @@ export const cherryPick = function (sourceId, targetId, tag) {
log.debug('Entering cherryPick:', sourceId, targetId, tag); log.debug('Entering cherryPick:', sourceId, targetId, tag);
sourceId = common.sanitizeText(sourceId, configApi.getConfig()); sourceId = common.sanitizeText(sourceId, configApi.getConfig());
targetId = common.sanitizeText(targetId, configApi.getConfig()); targetId = common.sanitizeText(targetId, configApi.getConfig());
if (tag === 'cherry-pick:<id>') {
tag = 'cherry-pick:' + sourceCommit.id;
}
tag = common.sanitizeText(tag, configApi.getConfig()); tag = common.sanitizeText(tag, configApi.getConfig());
if (!sourceId || typeof commits[sourceId] === 'undefined') { 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], parents: [head == null ? null : head.id, sourceCommit.id],
branch: curBranch, branch: curBranch,
type: commitType.CHERRY_PICK, type: commitType.CHERRY_PICK,
tag: tag, tag: tag ?? 'cherry-pick:' + sourceCommit.id,
}; };
head = commit; head = commit;
commits[commit.id] = commit; commits[commit.id] = commit;

View File

@@ -117,7 +117,7 @@ branchStatement
; ;
cherryPickStatement cherryPickStatement
: CHERRY_PICK COMMIT_ID STR {yy.cherryPick($3, '', 'cherry-pick:<id>')} : CHERRY_PICK COMMIT_ID STR {yy.cherryPick($3, '', undefined)}
| CHERRY_PICK COMMIT_ID STR COMMIT_TAG STR {yy.cherryPick($3, '', $5)} | CHERRY_PICK COMMIT_ID STR COMMIT_TAG STR {yy.cherryPick($3, '', $5)}
| CHERRY_PICK COMMIT_TAG STR COMMIT_ID STR {yy.cherryPick($5, '', $3)} | CHERRY_PICK COMMIT_TAG STR COMMIT_ID STR {yy.cherryPick($5, '', $3)}
; ;