Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

fix(turnrewind): canonical path identity using realpathSync.native for Windows 8.3 and mac /var aliases

yingtianlana1c44b944075
diff --git a/packages/dsh-tauri-turnrewind-ts/src/host/service/git-snapshot.ts b/packages/dsh-tauri-turnrewind-ts/src/host/service/git-snapshot.ts
index cd73b1b1..9393d0f2 100644
--- a/packages/dsh-tauri-turnrewind-ts/src/host/service/git-snapshot.ts
+++ b/packages/dsh-tauri-turnrewind-ts/src/host/service/git-snapshot.ts
@@ -31,6 +31,7 @@ import {
mkdirSync,
readdirSync,
readFileSync,
+ realpathSync,
renameSync,
rmdirSync,
rmSync,
@@ -345,15 +346,46 @@ function assertSafePath(workspaceDir: string, path: string): string {
return target
}
+/** Windows 路径分隔符(源码里避免裸控制字符,与 guard.ts 同一写法)。 */
+const WINDOWS_PATH_SEPARATOR = String.fromCharCode(92)
+
/**
* Canonical workspace identity shared by the ledger key, the snapshot repo
- * hash and maintenance purges: case-folded on case-insensitive platforms
- * (Windows NTFS, macOS APFS default) so one directory cannot spawn two
- * snapshot domains; Linux stays byte-exact. `platform` is injectable for tests.
+ * hash, workspace locks and maintenance purges. `resolve()` alone is not an
+ * identity: the same directory is reachable under different spellings —
+ * macOS /var → /private/var (os.tmpdir lives behind that symlink) and
+ * Windows 8.3 short names (CI runners export TEMP as
+ * C:\Users\RUNNER~1\... while the on-disk name is runneradmin) — and one
+ * workspace must not split into two snapshot domains. realpathSync folds
+ * every spelling of an existing path onto its on-disk form, the same
+ * canonical spelling gitWorkspace reports for the worktree, so keys written
+ * from a raw cwd and keys computed from the probed worktree always agree;
+ * case-insensitive platforms (Windows NTFS, macOS APFS default) then fold
+ * casing so one directory cannot spawn two snapshot domains, and Linux
+ * stays byte-exact. Unresolvable paths (missing or unreadable) keep the
+ * resolved spelling so the key stays deterministic instead of throwing; a
+ * later call once the directory exists canonicalizes. `platform` remains
+ * injectable for tests.
*/
export function workspaceKey(workspaceDir: string, platform: string = process.platform): string {
const normalized = resolve(workspaceDir)
- return platform === 'win32' || platform === 'darwin' ? normalized.toLowerCase() : normalized
+ // realpathSync.native wants native separators: pathe emits forward slashes
+ // (and can mangle bare drive roots), so rebuild the Windows form first.
+ // `.native` (not plain realpathSync) is load-bearing on Windows: libuv's
+ // JS-path realpath keeps 8.3 short names as-is (TEMP=C:\Users\RUNNER~1\...)
+ // while `realpathSync.native` (GetFinalPathNameByHandle) expands them to
+ // the on-disk long name — verified against a short-spelled git worktree
+ // where the two spellings must fold onto ONE key or every look-up splits.
+ let canonical = normalized
+ try {
+ const native = platform === 'win32' ? normalized.replaceAll('/', WINDOWS_PATH_SEPARATOR) : normalized
+ canonical = resolve(realpathSync.native(native))
+ }
+ catch {
+ // Missing or unreadable path: the resolved spelling is the best
+ // available key and stays stable across calls.
+ }
+ return platform === 'win32' || platform === 'darwin' ? canonical.toLowerCase() : canonical
}
export function workspaceHash(workspaceDir: string): string {
diff --git a/packages/dsh-tauri-turnrewind-ts/src/host/service/git-workspace.ts b/packages/dsh-tauri-turnrewind-ts/src/host/service/git-workspace.ts
index cb22fd2e..9f4e09b9 100644
--- a/packages/dsh-tauri-turnrewind-ts/src/host/service/git-workspace.ts
+++ b/packages/dsh-tauri-turnrewind-ts/src/host/service/git-workspace.ts
@@ -75,10 +75,18 @@ const REV_PARSE_ARGS = [
'info/exclude',
]
-/** realpathSync 安全包装:路径不存在时原样返回。macOS 上 /var → /private/var 的 symlink 在这里归一。pathe resolve 统一正斜杠。 */
+/**
+ * realpathSync 安全包装:路径不存在时原样返回。macOS 上 /var → /private/var 的
+ * symlink 在这里归一。用 `.native` 而非 plain realpathSync 是 Windows 的硬要求:
+ * libuv 的 JS-path 实现不会展开 8.3 短名(TEMP=C:\Users\RUNNER~1\... 原样保留),
+ * 而 `.native`(GetFinalPathNameByHandle)展开为磁盘上的长名——git 的
+ * --show-toplevel 输出的正是长名。若这里不展开,工作区以短名/长名两次调用
+ * gitWorkspace → 相对 .git 解析出不同字符串 → ensureRepository 的 gitDir 恒等
+ * 检查永远失败(TURNREWIND_GIT_REPOSITORY)。pathe resolve 统一正斜杠。
+ */
function safeRealpath(p: string): string {
try {
- return resolve(realpathSync(p))
+ return resolve(realpathSync.native(p))
}
catch {
return resolve(p)
@@ -92,9 +100,9 @@ function resolveInfo(requestedDir: string, stdout: string): GitWorkspaceInfo | u
// P2-11: macOS 上 /var → /private/var 的 symlink 会让两次调用(一次用
// mkdtemp 路径、一次用 realpath 后的 store.workspaceDir)产生不同字符串
// 的 gitDir —— ensureRepository 的恒等检查会永远失败。所有绝对路径统一
- // 通过 realpathSync 归一化 symlink 差异,保证同一 workspace 的两次调用
- // 产生完全一致的路径。--git-dir 等 relative path 以 requestedDir(git
- // 运行的 CWD)为 base 解析。
+ // 通过 safeRealpath(realpathSync.native,展开 symlink 与 Windows 8.3 短名)
+ // 归一化差异,保证同一 workspace 的两次调用产生完全一致的路径。--git-dir
+ // 等 relative path 以 requestedDir(git 运行的 CWD)为 base 解析。
const workspaceRoot = safeRealpath(resolve(requestedDir, lines[1]!))
const resolvedGitDir = safeRealpath(resolve(requestedDir, lines[2]!))
const resolvedCommonDir = safeRealpath(resolve(requestedDir, lines[3]!))
diff --git a/packages/dsh-tauri-turnrewind-ts/src/host/service/guard.ts b/packages/dsh-tauri-turnrewind-ts/src/host/service/guard.ts
index 78ded50d..abc44ee0 100644
--- a/packages/dsh-tauri-turnrewind-ts/src/host/service/guard.ts
+++ b/packages/dsh-tauri-turnrewind-ts/src/host/service/guard.ts
@@ -21,11 +21,13 @@ function normalizeDir(path: string): string {
? `${raw.slice(1)}/`
: raw
try {
- // realpathSync 需要平台分隔符(盘根 'C:' 会拼错路径)。
+ // realpathSync.native 与 git-workspace/workspaceKey 同一归一化口径:
+ // 展开 macOS /var → /private/var 与 Windows 8.3 短名(plain realpathSync
+ // 不会展开短名),保证系统目录判定不接受「换个拼写绕过」的路径。
const fsPath = process.platform === 'win32'
? corrected.replaceAll('/', BACKSLASH)
: corrected
- return realpathSync(fsPath)
+ return realpathSync.native(fsPath)
}
catch {
// Missing or unreadable paths still need a deterministic comparison key.
diff --git a/packages/dsh-tauri-turnrewind-ts/test/doctor.test.js b/packages/dsh-tauri-turnrewind-ts/test/doctor.test.js
index 9727088b..191f9781 100644
--- a/packages/dsh-tauri-turnrewind-ts/test/doctor.test.js
+++ b/packages/dsh-tauri-turnrewind-ts/test/doctor.test.js
@@ -19,16 +19,25 @@ it('parses --doctor as a standalone flag', () => {
it('collects a full read-only doctor report for an eligible workspace', async () => {
const root = await mkdtemp(join(tmpdir(), 'turnrewind-doctor-'))
const workspace = join(root, 'workspace')
+ let db
try {
await initGitWorkspace(workspace)
await writeFile(join(workspace, 'a.txt'), 'one')
await commitAll(workspace, 'initial')
const dataRoot = join(root, 'data')
- const db = openLedger(dataRoot)
+ // Close before the temp root is removed even when an assertion fails:
+ // an open SQLite handle makes Windows rm fail with EBUSY and masks the
+ // real failure (observed on CI).
+ db = openLedger(dataRoot)
const store = createSnapshotStore(dataRoot, workspace)
const before = await captureSnapshot(store, 'refs/turnrewind/doctor-before', 'before')
await writeFile(join(workspace, 'a.txt'), 'two')
await captureSnapshot(store, 'refs/turnrewind/doctor-after', 'after', before.commit)
+ // The ledger rows are written from the caller's raw spelling while the
+ // doctor resolves the key through the canonical probe result. CI temp
+ // dirs make the two spellings differ (macOS /var vs /private/var,
+ // Windows 8.3 RUNNER~1); workspaceKey must canonicalize both onto one
+ // identity or the "latest turn" section below reports none recorded.
registerWorkspace(db, workspaceKey(workspace), workspace, store.repoDir)
insertTurn(db, {
turnId: 'session:1',
@@ -55,9 +64,9 @@ it('collects a full read-only doctor report for an eligible workspace', async ()
const fencedReport = await collectDoctorReport(db, dataRoot, { session: { id: 'session', header: { cwd: workspace } } })
assert.match(fencedReport, /- recovery fence: 1 workspace\(s\) BLOCKED/u)
assert.match(fencedReport, /undo → session:1/u)
- db.close()
}
finally {
+ db?.close()
await rm(root, { recursive: true, force: true })
}
})
diff --git a/packages/dsh-tauri-turnrewind-ts/test/git-snapshot.test.js b/packages/dsh-tauri-turnrewind-ts/test/git-snapshot.test.js
index 5d9cd562..ca315f4b 100644
--- a/packages/dsh-tauri-turnrewind-ts/test/git-snapshot.test.js
+++ b/packages/dsh-tauri-turnrewind-ts/test/git-snapshot.test.js
@@ -3,7 +3,7 @@ import { chmod, mkdir, mkdtemp, readFile, rm, stat, symlink, writeFile } from 'n
import { tmpdir } from 'node:os'
import { join } from 'pathe'
import { it } from 'vitest'
-import { captureSnapshot, classifyPathChange, createSnapshotStore, currentState, diffAgainstDisk, gitAvailable, probeWorkspace, restorePath, snapshotDiff, snapshotFileDiff, stateAt, workspaceKey } from '../src/host/service/git-snapshot'
+import { captureSnapshot, classifyPathChange, createSnapshotStore, currentState, diffAgainstDisk, gitAvailable, probeWorkspace, restorePath, snapshotDiff, snapshotFileDiff, stateAt, workspaceHash, workspaceKey } from '../src/host/service/git-snapshot'
import { completeUndoTransaction, createOperation, getLatestTurn, insertTurn, openLedger, settleInterruptedTurn, settleTurn } from '../src/host/service/ledger'
import { initGitWorkspace, resolvedRealPath } from './git-test-utils.js'
@@ -408,7 +408,32 @@ it('probes git availability once per process', async () => {
it('folds path case on case-insensitive platforms only', () => {
// Windows and macOS (APFS default) treat the two spellings as one
// workspace; Linux keeps them distinct.
- assert.equal(workspaceKey('C:\Proj\One', 'win32'), workspaceKey('c:\proj\one', 'win32'))
+ assert.equal(workspaceKey('C:\\Proj\\One', 'win32'), workspaceKey('c:\\proj\\one', 'win32'))
assert.equal(workspaceKey('/Users/dev/Proj', 'darwin'), workspaceKey('/Users/dev/proj', 'darwin'))
assert.notEqual(workspaceKey('/home/dev/Proj', 'linux'), workspaceKey('/home/dev/proj', 'linux'))
})
+
+it('maps different spellings of one directory to a single workspace identity', async () => {
+ const root = await mkdtemp(join(tmpdir(), 'turnrewind-key-spelling-'))
+ const workspace = join(root, 'workspace')
+ try {
+ await initGitWorkspace(workspace)
+ // CI temp dirs are reachable under different spellings: macOS /var vs
+ // /private/var (os.tmpdir sits behind that symlink) and Windows 8.3
+ // short names (TEMP=C:\Users\RUNNER~1\... on the runner). The caller's
+ // spelling and the canonical on-disk spelling must produce one key and
+ // one snapshot-repo hash, or a workspace splits into two domains.
+ assert.equal(workspaceKey(workspace), workspaceKey(resolvedRealPath(workspace)))
+ assert.equal(workspaceHash(workspace), workspaceHash(resolvedRealPath(workspace)))
+
+ // A link alias points at the same directory: junctions need no
+ // elevation on Windows, plain symlinks cover POSIX.
+ const alias = join(root, 'workspace-alias')
+ await symlink(workspace, alias, process.platform === 'win32' ? 'junction' : 'dir')
+ assert.equal(workspaceKey(alias), workspaceKey(workspace))
+ assert.equal(workspaceHash(alias), workspaceHash(workspace))
+ }
+ finally {
+ await rm(root, { recursive: true, force: true })
+ }
+})
diff --git a/packages/dsh-tauri-turnrewind-ts/test/git-test-utils.js b/packages/dsh-tauri-turnrewind-ts/test/git-test-utils.js
index 22751a4b..598b54f9 100644
--- a/packages/dsh-tauri-turnrewind-ts/test/git-test-utils.js
+++ b/packages/dsh-tauri-turnrewind-ts/test/git-test-utils.js
@@ -6,11 +6,13 @@ import { resolve } from 'pathe'
/**
* macOS 上 /var → /private/var 的 symlink 导致 mkdtemp 返回的路径与
- * git --show-toplevel 返回的路径不同。测试比较路径时统一走 realpath
- * + pathe resolve 归一化。
+ * git --show-toplevel 返回的路径不同;Windows CI 上 TEMP 还可能是 8.3 短名
+ * (C:\Users\RUNNER~1\...)而 git 返回磁盘长名。测试比较路径时统一走
+ * realpathSync.native + pathe resolve 归一化——`.native` 会把 8.3 短名展开为
+ * 长名(plain realpathSync 不会),与生产侧 safeRealpath/workspaceKey 一致。
*/
export function resolvedRealPath(p) {
- return resolve(realpathSync(p))
+ return resolve(realpathSync.native(p))
}
export function runGit(cwd, args) {
diff --git a/packages/dsh-tauri-turnrewind-ts/test/git-worktree.test.js b/packages/dsh-tauri-turnrewind-ts/test/git-worktree.test.js
index 37f07002..0110b559 100644
--- a/packages/dsh-tauri-turnrewind-ts/test/git-worktree.test.js
+++ b/packages/dsh-tauri-turnrewind-ts/test/git-worktree.test.js
@@ -1,7 +1,7 @@
import assert from 'node:assert/strict'
import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
-import { join, resolve } from 'pathe'
+import { join } from 'pathe'
import { it } from 'vitest'
import { captureSnapshot, createSnapshotStore, gitRef, restorePath, stateAt } from '../src/host/service/git-snapshot'
import { commitAll, gitOutput, initGitWorkspace, resolvedRealPath, runGit } from './git-test-utils.js'
@@ -67,7 +67,10 @@ it('isolates linked worktrees of one repository into separate snapshot stores',
await mkdir(join(linked, 'sub'))
const subStore = createSnapshotStore(data, join(linked, 'sub'))
assert.equal(subStore.repoDir, linkedStore.repoDir)
- assert.equal(subStore.workspaceDir, resolve(linked))
+ // store.workspaceDir is the canonical on-disk root (same spelling
+ // gitWorkspace reports); the raw mkdtemp spelling may differ on CI
+ // (macOS /var vs /private/var, Windows 8.3 RUNNER~1 vs runneradmin).
+ assert.equal(subStore.workspaceDir, resolvedRealPath(linked))
}
finally {
await rm(root, { recursive: true, force: true })
diff --git a/packages/dsh-tauri-turnrewind-ts/test/guard.test.js b/packages/dsh-tauri-turnrewind-ts/test/guard.test.js
index 10995fb4..a83aa1c4 100644
--- a/packages/dsh-tauri-turnrewind-ts/test/guard.test.js
+++ b/packages/dsh-tauri-turnrewind-ts/test/guard.test.js
@@ -1,7 +1,7 @@
import assert from 'node:assert/strict'
import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises'
import { homedir, tmpdir } from 'node:os'
-import { dirname, join, parse, resolve } from 'pathe'
+import { dirname, join, parse } from 'pathe'
import { it } from 'vitest'
import { createSnapshotStore, probeWorkspace } from '../src/host/service/git-snapshot'
import { isSystemSensitiveWorkspace } from '../src/host/service/guard'
@@ -64,7 +64,11 @@ it('canonicalizes a session cwd below the worktree root to the Git root', async
const nestedStore = createSnapshotStore(join(root, 'data'), nested)
const rootStore = createSnapshotStore(join(root, 'data'), workspace)
assert.equal(nestedStore.repoDir, rootStore.repoDir)
- assert.equal(nestedStore.workspaceDir, resolve(workspace))
+ // store.workspaceDir is the canonical on-disk worktree root (the same
+ // spelling gitWorkspace reports). Compare against the canonical form:
+ // CI temp dirs are reachable under a raw spelling that differs (macOS
+ // /var vs /private/var, Windows 8.3 RUNNER~1 vs runneradmin).
+ assert.equal(nestedStore.workspaceDir, resolvedRealPath(workspace))
}
finally {
await rm(root, { recursive: true, force: true })
diff --git a/packages/dsh-tauri-turnrewind-ts/test/maintenance.test.js b/packages/dsh-tauri-turnrewind-ts/test/maintenance.test.js
index ca9b2bbd..801bcb5c 100644
--- a/packages/dsh-tauri-turnrewind-ts/test/maintenance.test.js
+++ b/packages/dsh-tauri-turnrewind-ts/test/maintenance.test.js
@@ -1,6 +1,6 @@
import assert from 'node:assert/strict'
import { existsSync } from 'node:fs'
-import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
+import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'pathe'
import { it } from 'vitest'
@@ -128,6 +128,42 @@ it('purges only turnrewind data; the user repository and other workspaces stay i
}
})
+it('purges data registered under a different spelling of the same workspace', async () => {
+ const root = await mkdtemp(join(tmpdir(), 'turnrewind-purge-spelling-'))
+ const workspace = join(root, 'ws')
+ try {
+ await initGitWorkspace(workspace)
+ const db = openLedger(root)
+ registerWorkspace(db, workspaceKey(workspace), workspace, join(root, 'snapshots', 'ws.git'))
+ insertTurn(db, {
+ turnId: 'session:1',
+ sessionId: 'session',
+ workspaceKey: workspaceKey(workspace),
+ startedAt: '2026-01-01T00:00:00.000Z',
+ beforeRef: 'refs/turnrewind/turn-session-1-before',
+ })
+ settleTurn(db, 'session:1', 'refs/turnrewind/turn-session-1-after')
+ db.close()
+
+ const repoDir = join(root, 'snapshots', `${workspaceHash(workspace)}.git`)
+ await mkdir(join(repoDir, 'objects'), { recursive: true })
+ await writeFile(join(repoDir, 'HEAD'), 'ref: refs/heads/main\n')
+
+ // Purge through a link alias of the same directory (junctions need no
+ // elevation on Windows): canonical identity must land on the one
+ // snapshot repo and ledger domain instead of forking a second empty one.
+ const alias = join(root, 'ws-alias')
+ await symlink(workspace, alias, process.platform === 'win32' ? 'junction' : 'dir')
+ const summary = purgeWorkspace(root, alias)
+ assert.equal(summary.repoExisted, true)
+ assert.deepEqual(summary.ledger, { operations: 0, notices: 0, plans: 0, turns: 1, workspaces: 1 })
+ assert.equal(existsSync(repoDir), false)
+ }
+ finally {
+ await rm(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 300 })
+ }
+})
+
it('purges pending plans bound to the workspace', async () => {
const root = await mkdtemp(join(tmpdir(), 'turnrewind-purge-plans-'))
const workspace = join(root, 'ws')
diff --git a/packages/dsh-tauri-turnrewind-ts/test/retention.test.js b/packages/dsh-tauri-turnrewind-ts/test/retention.test.js
index 2f12aca4..fc8344cb 100644
--- a/packages/dsh-tauri-turnrewind-ts/test/retention.test.js
+++ b/packages/dsh-tauri-turnrewind-ts/test/retention.test.js
@@ -11,8 +11,16 @@ import { enforceRetention } from '../src/host/service/retention'
import { gitOutput, initGitWorkspace } from './git-test-utils.js'
const cleanups = []
+// Ledgers must close before the temp roots are removed: an open SQLite handle
+// on Windows makes rm fail with EBUSY, which then masks the real failure.
+// (CI observed exactly this: the prunes-unreachable test failed with EBUSY on
+// the retry path instead of reporting its own assertion.)
+const openDbs = []
afterEach(async () => {
+ for (const db of openDbs.reverse())
+ db.close()
+ openDbs.length = 0
for (const dispose of cleanups.reverse())
await dispose()
cleanups.length = 0
@@ -26,6 +34,12 @@ async function makeRoot() {
return root
}
+function openLedgerTracked(ledgerRoot) {
+ const db = openLedger(ledgerRoot)
+ openDbs.push(db)
+ return db
+}
+
async function makeWorkspace(root, name) {
const workspace = join(root, name)
await initGitWorkspace(workspace)
@@ -44,7 +58,7 @@ function seedTurns(db, workspaceKey, count, offset = 0) {
it('expires turns beyond the retention count, keeping the most recent', async () => {
const root = await makeRoot()
const workspace = await makeWorkspace(root, 'ws')
- const db = openLedger(join(root, 'ledger'))
+ const db = openLedgerTracked(join(root, 'ledger'))
const store = createSnapshotStore(join(root, 'data'), workspace)
seedTurns(db, workspaceKey(store.workspaceDir), 5)
process.env.TURNREWIND_RETAIN_TURNS = '3'
@@ -62,13 +76,12 @@ it('expires turns beyond the retention count, keeping the most recent', async ()
SELECT error FROM turns WHERE reversible = 0 AND turn_id LIKE 'session:%'
`).all().map(row => row.error)
assert.ok(archived.every(error => /retention:/u.test(error)))
- db.close()
})
it('rebuilds the snapshot repository when it exceeds the size cap', async () => {
const root = await makeRoot()
const workspace = await makeWorkspace(root, 'ws')
- const db = openLedger(join(root, 'ledger'))
+ const db = openLedgerTracked(join(root, 'ledger'))
const store = createSnapshotStore(join(root, 'data'), workspace)
seedTurns(db, workspaceKey(store.workspaceDir), 2)
// Simulate a bloated snapshot repo (the size walk reads the real directory).
@@ -98,13 +111,12 @@ it('rebuilds the snapshot repository when it exceeds the size cap', async () =>
// Two-phase rebuild: no half-deleted live directory or quarantine leftover.
assert.equal(existsSync(store.repoDir), false)
assert.equal(existsSync(`${store.repoDir}.retention-quarantine`), false)
- db.close()
})
it('keeps everything when under both limits', async () => {
const root = await makeRoot()
const workspace = await makeWorkspace(root, 'ws')
- const db = openLedger(join(root, 'ledger'))
+ const db = openLedgerTracked(join(root, 'ledger'))
const store = createSnapshotStore(join(root, 'data'), workspace)
seedTurns(db, workspaceKey(store.workspaceDir), 3)
process.env.TURNREWIND_RETAIN_TURNS = '10'
@@ -114,13 +126,12 @@ it('keeps everything when under both limits', async () => {
assert.equal(result.expiredByCount, 0)
assert.equal(result.rebuilt, false)
assert.equal(db.prepare('SELECT COUNT(*) AS count FROM turns WHERE reversible = 1').get().count, 3)
- db.close()
})
it('prunes unreachable loose objects before measuring the size cap', async () => {
const root = await makeRoot()
const workspace = await makeWorkspace(root, 'ws')
- const db = openLedger(join(root, 'ledger'))
+ const db = openLedgerTracked(join(root, 'ledger'))
const store = createSnapshotStore(join(root, 'data'), workspace)
// A real capture first: the private repository must exist (and the reachable
// objects it holds must survive the prune).
@@ -138,5 +149,4 @@ it('prunes unreachable loose objects before measuring the size cap', async () =>
assert.equal(existsSync(loosePath), false, 'unreachable loose object must be pruned')
// The reachable snapshot chain is untouched by the prune.
assert.equal((await gitOutput(workspace, ['--git-dir', store.repoDir, 'cat-file', '-t', seed.commit])).trim(), 'commit')
- db.close()
})