mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-17 19:24:10 +01:00
fixed checkout branch with no commits
This commit is contained in:
@@ -399,15 +399,12 @@ export const checkout = function (branch: string) {
|
|||||||
} else {
|
} else {
|
||||||
curBranch = branch;
|
curBranch = branch;
|
||||||
const id = branches.get(curBranch);
|
const id = branches.get(curBranch);
|
||||||
|
if (id === undefined || !id) {
|
||||||
if (id === null || id === undefined) {
|
head = null;
|
||||||
throw new Error('Branch ' + branch + ' has no commits');
|
} else {
|
||||||
}
|
|
||||||
if (commits.get(id) === undefined) {
|
|
||||||
throw new Error('Branch ' + branch + ' has no commits');
|
|
||||||
}
|
|
||||||
head = commits.get(id) ?? null;
|
head = commits.get(id) ?? null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// export const reset = function (commitRef) {
|
// export const reset = function (commitRef) {
|
||||||
|
|||||||
Reference in New Issue
Block a user