mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-06 01:27:24 +03:00
resetHeadCommit to handle single commit reset
This commit is contained in:
parent
a5d898182a
commit
f65c5cad21
@ -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(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user