resetHeadCommit to handle single commit reset

This commit is contained in:
Nikita Galaiko 2023-10-12 08:38:22 +02:00 committed by GitButler
parent a5d898182a
commit f65c5cad21

View File

@ -200,15 +200,19 @@
}
function resetHeadCommit() {
if (branch.commits.length < 2) {
return;
if (branch.commits.length > 1) {
branchController.resetBranch({
projectId,
branchId: branch.id,
targetCommitOid: branch.commits[1].id
});
} else if (branch.commits.length === 1 && base) {
branchController.resetBranch({
projectId,
branchId: branch.id,
targetCommitOid: base?.baseSha
});
}
branchController.resetBranch({
projectId,
branchId: branch.id,
targetCommitOid: branch.commits[1].id
});
}
onMount(() => {