Skip to content

Commit 4fd3178

Browse files
committed
fix: use commitSHAThatBranchPointsTo instead of targets[0] (need commit SHA, not branch name)
Signed-off-by: Kipras Melnikovas <[email protected]>
1 parent 076c461 commit 4fd3178

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";
@@ -570,8 +571,8 @@ export const gitStackedRebase = async (
570571
* TODO thus consider.
571572
*
572573
*/
573-
const oldLatestBranchCmd: GoodCommand = goodCommands[oldLatestBranchCmdIndex];
574-
const newLatestBranchCmd: GoodCommand = goodCommands[newLatestBranchCmdIndex];
574+
const oldLatestBranchCmd: GoodCommandStacked = goodCommands[oldLatestBranchCmdIndex] as GoodCommandStacked; // TODO TS
575+
const newLatestBranchCmd: GoodCommandStacked = goodCommands[newLatestBranchCmdIndex] as GoodCommandStacked; // TODO TS
575576

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

588589
/**

0 commit comments

Comments
 (0)