Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit 49b33a6

Browse files
committed
also delete bookmark on untrack
1 parent 3b8620d commit 49b33a6

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

packages/core/src/stacks/merge.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import type { Engine } from "../engine";
22
import { mergePR, updatePR, waitForMergeable } from "../github/pr-actions";
33
import { getPRForBranch } from "../github/pr-status";
4-
import { getTrunk, list, push, rebase, runJJ, status } from "../jj";
4+
import {
5+
deleteBookmark,
6+
getTrunk,
7+
list,
8+
push,
9+
rebase,
10+
runJJ,
11+
status,
12+
} from "../jj";
513
import { createError, err, ok, type Result } from "../result";
614
import type { MergeOptions, MergeResult, PRToMerge } from "../types";
715

@@ -172,11 +180,17 @@ export async function mergeStack(
172180

173181
merged.push(prItem);
174182

175-
// Abandon this commit immediately after merge, before rebasing next
176-
// Must do this before rebase because rebase -r changes descendant changeIds
183+
// Clean up the merged commit (same as arr sync does):
184+
// 1. Abandon the commit (must do before rebase because rebase -r changes changeIds)
185+
// 2. Delete the local bookmark
186+
// 3. Untrack from engine
177187
if (prItem.changeId) {
178188
await runJJ(["abandon", prItem.changeId]);
179189
}
190+
await deleteBookmark(prItem.bookmarkName);
191+
if (engine.isTracked(prItem.bookmarkName)) {
192+
engine.untrack(prItem.bookmarkName);
193+
}
180194

181195
if (nextPR) {
182196
// Fetch to get the merged commit into local main

0 commit comments

Comments
 (0)