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 {
|
} 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 {
|
||||||
|
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