mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
fixed checkout branch with no commits
This commit is contained in:
parent
ebd4da95cd
commit
5460bc0a0c
@ -399,14 +399,11 @@ export const checkout = function (branch: string) {
|
||||
} else {
|
||||
curBranch = branch;
|
||||
const id = branches.get(curBranch);
|
||||
|
||||
if (id === null || id === undefined) {
|
||||
throw new Error('Branch ' + branch + ' has no commits');
|
||||
if (id === undefined || !id) {
|
||||
head = null;
|
||||
} else {
|
||||
head = commits.get(id) ?? null;
|
||||
}
|
||||
if (commits.get(id) === undefined) {
|
||||
throw new Error('Branch ' + branch + ' has no commits');
|
||||
}
|
||||
head = commits.get(id) ?? null;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user