mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-23 18:26:39 +02:00
fix: Check if parentCommit is provided
This commit is contained in:
@@ -277,7 +277,10 @@ export const cherryPick = function (sourceId, targetId, tag, parentCommitId) {
|
|||||||
}
|
}
|
||||||
let sourceCommit = commits[sourceId];
|
let sourceCommit = commits[sourceId];
|
||||||
let sourceCommitBranch = sourceCommit.branch;
|
let sourceCommitBranch = sourceCommit.branch;
|
||||||
if (!(Array.isArray(sourceCommit.parents) && sourceCommit.parents.includes(parentCommitId))) {
|
if (
|
||||||
|
parentCommitId &&
|
||||||
|
!(Array.isArray(sourceCommit.parents) && sourceCommit.parents.includes(parentCommitId))
|
||||||
|
) {
|
||||||
let error = new Error(
|
let error = new Error(
|
||||||
'Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.'
|
'Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.'
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user