Skip to content

Commit 08453c5

Browse files
committed
fix: use commitSHAThatBranchPointsTo instead of targets[0] (need commit SHA, not branch name)
Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
1 parent 56367cd commit 08453c5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

git-stacked-rebase.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import { parseTodoOfStackedRebase } from "./parse-todo-of-stacked-rebase/parseTo
2222
import { Termination } from "./util/error";
2323
import { assertNever } from "./util/assertNever";
2424
import {
25-
GoodCommand, //
25+
GoodCommand,
26+
GoodCommandStacked, //
2627
namesOfRebaseCommandsThatMakeRebaseExitToPause,
2728
StackedRebaseCommand,
2829
} from "./parse-todo-of-stacked-rebase/validator";
@@ -569,8 +570,8 @@ export const gitStackedRebase = async (
569570
* TODO thus consider.
570571
*
571572
*/
572-
const oldLatestBranchCmd: GoodCommand = goodCommands[oldLatestBranchCmdIndex];
573-
const newLatestBranchCmd: GoodCommand = goodCommands[newLatestBranchCmdIndex];
573+
const oldLatestBranchCmd: GoodCommandStacked = goodCommands[oldLatestBranchCmdIndex] as GoodCommandStacked; // TODO TS
574+
const newLatestBranchCmd: GoodCommandStacked = goodCommands[newLatestBranchCmdIndex] as GoodCommandStacked; // TODO TS
574575

575576
/**
576577
* create the new "latest branch"
@@ -581,7 +582,7 @@ export const gitStackedRebase = async (
581582
* move the old "latest branch" earlier to it's target
582583
*/
583584
await repo.checkoutBranch(oldLatestBranchCmd.targets![0]);
584-
const commit: Git.Commit = await Git.Commit.lookup(repo, oldLatestBranchCmd.targets![0]);
585+
const commit: Git.Commit = await Git.Commit.lookup(repo, oldLatestBranchCmd.commitSHAThatBranchPointsTo!);
585586
await Git.Reset.reset(repo, commit, Git.Reset.TYPE.HARD, {});
586587

587588
/**

0 commit comments

Comments
 (0)