Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: prevent reused claim branches inheriting retired settings (#13328)
[._.]/ Adam Eivy1f778cea5742
diff --git a/server/lib/README.md b/server/lib/README.mdindex 09e9661a00..44c74487d6 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -26,7 +26,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| Module | Purpose ||---|---|| `checkoutRetirementAdmission.js` | Durable common-repository publication/cut admission for explicit initialized-checkout quarantine; pending reservations survive restart and block managed checkout mutations until verified recovery. |-| `branchRetirementArchive.js` | `preserveBranchRetirement` preserves the shared branch reflog verbatim, records its filesystem metadata, and verifies a standalone bundle containing the current tip and every old/new reflog commit before local branch retirement. Its final verifier holds changed refs or reflogs; unsupported storage, missing objects and archive failures retain the branch. |+| `branchRetirementArchive.js` | `preserveBranchRetirement` privately archives exact shared configuration, the branch reflog and a verified standalone recovery bundle. Retirement retains Git's receiver lease/holder guards, then removes only the unchanged branch configuration under native config/ref locks. Changed evidence, recreated refs, external configuration sources and uncertain deletion retain live settings and leave retirement unresolved. || `reconcileRetirementEvidence.js` | Matches exact checkout retirement receipts and retains unresolved cleanup obligations. Server-created generation timestamps prevent an old archive receipt from completing a recreated checkout at the same branch, path and head. || `backupSharedAdmission.js` | Durable cross-process backup cuts and publication leases, with fail-closed owner recovery. || `runtimeFilePublication.js` | Admitted runtime recording updates with rollback of the prior file pair on failure. |diff --git a/server/lib/branchRetirementArchive.js b/server/lib/branchRetirementArchive.jsindex 1a711964d4..d8555a9724 100644--- a/server/lib/branchRetirementArchive.js+++ b/server/lib/branchRetirementArchive.js@@ -1,26 +1,26 @@-/** Preserve shared branch reflogs and their objects before branch retirement.+/** Preserve shared branch configuration, reflogs and objects before retirement.* Worktree-private archives do not cover logs/refs/heads, which Git removes* with the branch. This leaf also covers branches that have no checkout.*/-import { lstat, readFile, chmod } from 'node:fs/promises';+import { lstat, readFile, chmod, open, unlink, rename, mkdir } from 'node:fs/promises';import { createHash, randomUUID } from 'node:crypto';-import { join } from 'node:path';+import { dirname, join } from 'node:path';import { execGit } from './execGit.js';import { PATHS } from './paths.js';import { ensureDir, sha256File, writeFileGuarded } from './fileCore.js';-const MAX_REFLOG_BYTES = 25 * 1024 * 1024;+const MAX_EVIDENCE_BYTES = 25 * 1024 * 1024;const MAX_RECOVERY_HEADS = 1024;const git = (repoPath, args) => execGit(args, repoPath).then(result => result.stdout.trim());const digest = bytes => createHash('sha256').update(bytes).digest('hex');-async function readReflog(path) {+async function readEvidence(path) {const info = await lstat(path).catch(error => {if (error.code === 'ENOENT') return null;throw error;});if (!info) return { bytes: null, identity: null };- if (!info.isFile() || info.size > MAX_REFLOG_BYTES) throw new Error('branch reflog cannot be archived');+ if (!info.isFile() || info.size > MAX_EVIDENCE_BYTES) throw new Error('branch retirement evidence cannot be archived');const bytes = await readFile(path);const identity = {dev: info.dev, ino: info.ino, mode: info.mode, size: info.size,@@ -29,6 +29,37 @@ async function readReflog(path) {return { bytes, identity };}+const unchanged = (left, right) => JSON.stringify(left.identity) === JSON.stringify(right.identity);++// Included/global/worktree settings cannot be retired by editing the shared+// config. Refuse them rather than leave a reused name with inherited settings.+async function branchConfiguration(repoPath, branch) {+ const pattern = `^branch\\.${branch.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\.[^.]+$`;+ const query = async scope => {+ const result = await execGit(['config', '--null', '--show-origin', ...scope, '--get-regexp', pattern], repoPath, { ignoreExitCode: true });+ if (![0, 1].includes(result.exitCode)) throw new Error('branch configuration cannot be read');+ return result.stdout;+ };+ const local = await query(['--local', '--no-includes']);+ if (local !== await query(['--includes'])) throw new Error('branch configuration has an external source');+ return local;+}++async function withNativeLock(path, bytes, work) {+ const handle = await open(path, 'wx', 0o600);+ try {+ await handle.writeFile(bytes);+ await handle.sync();+ } finally { await handle.close(); }+ const owned = await readEvidence(path);+ try { return await work(owned); }+ finally {+ // Never remove a replaced or modified lock belonging to another writer.+ const current = await readEvidence(path);+ if (current.bytes && unchanged(current, owned)) await unlink(path);+ }+}+export async function preserveBranchRetirement(repoPath, commonGitDir, branch, expectedHead, { cosDir = PATHS.cos } = {}) {const storage = await execGit(['config', '--get', 'extensions.refStorage'], repoPath, { ignoreExitCode: true });if ((storage.exitCode !== 0 && storage.exitCode !== 1) || (storage.stdout.trim() && storage.stdout.trim() !== 'files')) {@@ -37,7 +68,11 @@ export async function preserveBranchRetirement(repoPath, commonGitDir, branch, econst ref = `refs/heads/${branch}`;if (await git(repoPath, ['rev-parse', '--verify', ref]) !== expectedHead) throw new Error('branch head changed');const source = join(commonGitDir, 'logs', 'refs', 'heads', ...branch.split('/'));- const before = await readReflog(source);+ const before = await readEvidence(source);+ const configPath = join(commonGitDir, 'config');+ const config = await readEvidence(configPath);+ if (!config.bytes) throw new Error('shared branch configuration is missing');+ const settings = await branchConfiguration(repoPath, branch);const recoveryHeads = new Set([expectedHead]);for (const line of (before.bytes?.toString('utf8') || '').split('\n').filter(Boolean)) {const match = /^([a-f0-9]{40}(?:[a-f0-9]{24})?) ([a-f0-9]{40}(?:[a-f0-9]{24})?) /.exec(line);@@ -49,6 +84,16 @@ export async function preserveBranchRetirement(repoPath, commonGitDir, branch, econst archiveDir = join(cosDir, 'branch-retirement-archives', id);await ensureDir(archiveDir);await chmod(archiveDir, 0o700);+ // Keep the original bytes, including duplicate values and formatting. Both+ // copies are private; the prepared copy lets Git remove precisely its section.+ const configCopy = join(archiveDir, 'config');+ const retiredCopy = join(archiveDir, 'config.retired');+ await writeFileGuarded(configCopy, config.bytes, { flag: 'wx', mode: 0o600 });+ await writeFileGuarded(retiredCopy, config.bytes, { flag: 'wx', mode: 0o600 });+ if (settings) await git(repoPath, ['config', '--file', retiredCopy, '--remove-section', `branch.${branch}`]);+ await chmod(retiredCopy, 0o600);+ const retiredConfig = await readFile(retiredCopy);+ const retiredSha256 = digest(retiredConfig);if (before.bytes) {const copy = join(archiveDir, 'reflog');await writeFileGuarded(copy, before.bytes, { flag: 'wx', mode: 0o600 });@@ -75,20 +120,48 @@ export async function preserveBranchRetirement(repoPath, commonGitDir, branch, econst bundleSha256 = await sha256File(bundle);const manifestPath = join(archiveDir, 'manifest.json');const manifest = `${JSON.stringify({- version: 1, repoPath, commonGitDir, branch, expectedHead, archivedAt: new Date().toISOString(),+ version: 2, repoPath, commonGitDir, branch, expectedHead, archivedAt: new Date().toISOString(),reflog: { present: before.bytes !== null, source, identity: before.identity },+ configuration: { source: configPath, identity: config.identity, retiredSha256,+ restore: 'Inspect config and restore only the archived branch section into the current repository configuration.' },recoveryHeads: [...recoveryHeads], bundleSha256,restore: 'git -C <repo> fetch <archive>/commits.bundle refs/portos/branch-archive/<archive-id>/<head>:refs/heads/<restored-branch>',}, null, 2)}\n`;await writeFileGuarded(manifestPath, manifest, { flag: 'wx', mode: 0o600 });- const verify = () => Promise.all([- git(repoPath, ['rev-parse', '--verify', ref]), readReflog(source),+ const verifyConfig = async () => unchanged(await readEvidence(configPath), config)+ && await branchConfiguration(repoPath, branch) === settings;+ const verifyArchive = () => Promise.all([sha256File(bundle), readFile(manifestPath, 'utf8'),before.bytes ? sha256File(join(archiveDir, 'reflog')) : null,- ]).then(([head, current, bundleHash, currentManifest, reflogHash]) =>- head === expectedHead && JSON.stringify(current.identity) === JSON.stringify(before.identity)- && bundleHash === bundleSha256 && currentManifest === manifest- && (!before.bytes || reflogHash === before.identity.sha256)).catch(() => false);+ sha256File(configCopy), sha256File(retiredCopy),+ ]).then(([bundleHash, currentManifest, reflogHash, configHash, retiredHash]) =>+ bundleHash === bundleSha256 && currentManifest === manifest+ && (!before.bytes || reflogHash === before.identity.sha256)+ && configHash === config.identity.sha256 && retiredHash === retiredSha256).catch(() => false);+ const verify = () => Promise.all([+ git(repoPath, ['rev-parse', '--verify', ref]), readEvidence(source), verifyConfig(), verifyArchive(),+ ]).then(([head, current, configValid, archiveValid]) =>+ head === expectedHead && unchanged(current, before) && configValid && archiveValid).catch(() => false);if (!await verify()) throw new Error('branch reflog or archive changed during archival');- return { archiveDir, verify };+ const retire = deleteRef => withNativeLock(`${configPath}.lock`, retiredConfig, async configLock => {+ if (!await verify() || !await deleteRef()) return false;+ // The receiver's lease and holder checks remain authoritative for deletion.+ // Afterwards lock the absent ref so a native Git writer cannot recreate it+ // between the final incarnation check and the configuration rename.+ const refPath = join(commonGitDir, ...ref.split('/'));+ await mkdir(dirname(refPath), { recursive: true });+ return withNativeLock(`${refPath}.lock`, Buffer.alloc(0), async () => {+ const absent = await execGit(['show-ref', '--verify', '--quiet', ref], repoPath, { ignoreExitCode: true });+ const holders = await git(repoPath, ['worktree', 'list', '--porcelain', '-z']);+ if (absent.exitCode !== 1 || (await readEvidence(refPath)).bytes !== null+ || holders.split('\0').includes(`branch ${ref}`) || !await verifyArchive() || !await verifyConfig()+ || !unchanged(await readEvidence(`${configPath}.lock`), configLock)) return false;+ if (settings) {+ await chmod(`${configPath}.lock`, config.identity.mode & 0o777);+ await rename(`${configPath}.lock`, configPath);+ }+ return true;+ });+ });+ return { archiveDir, verify, retire };}diff --git a/server/services/worktreeManager.js b/server/services/worktreeManager.jsindex 115bfea8fd..3ff3c00c3a 100644--- a/server/services/worktreeManager.js+++ b/server/services/worktreeManager.js@@ -289,10 +289,12 @@ export function deleteCompletedLocalBranch(repoPath, branch, expectedHead, { befconst preservation = await preserveBranchRetirement(repoPath, common, branch, expectedHead);if (!await preservation.verify()) return false;await Promise.resolve().then(beforeMutation).catch(error => { callbackError = error; throw error; });- const result = await execGit(['push',- '--receive-pack=git -c receive.denyCurrentBranch=refuse -c receive.denyDeleteCurrent=refuse -c receive.autogc=false receive-pack',- `--force-with-lease=${ref}:${expectedHead}`, '--', common, `:${ref}`], repoPath, { ignoreExitCode: true });- return result.exitCode === 0;+ return preservation.retire(async () => {+ const result = await execGit(['push',+ '--receive-pack=git -c receive.denyCurrentBranch=refuse -c receive.denyDeleteCurrent=refuse -c receive.autogc=false receive-pack',+ `--force-with-lease=${ref}:${expectedHead}`, '--', common, `:${ref}`], repoPath, { ignoreExitCode: true });+ return result.exitCode === 0;+ });}).catch(error => { if (error === callbackError) throw error; return false; });}diff --git a/server/services/worktreeManager.test.js b/server/services/worktreeManager.test.jsindex 632a91bd9c..e7f3ae03f7 100644--- a/server/services/worktreeManager.test.js+++ b/server/services/worktreeManager.test.js@@ -7,7 +7,8 @@ import { dirname, join } from 'path';// Stub every git operation; lifecycle tests exercise the real service without// creating, changing or removing a live repository.const preserveCheckoutMock = vi.fn(async () => ({ archiveDir: '/archive', verify: async () => null }));-const preserveBranchMock = vi.fn(async () => ({ archiveDir: '/branch-archive', verify: async () => true }));+const preservedBranch = () => ({ archiveDir: '/branch-archive', verify: async () => true, retire: work => work() });+const preserveBranchMock = vi.fn(async () => preservedBranch());vi.mock('../lib/branchRetirementArchive.js', () => ({ preserveBranchRetirement: (...args) => preserveBranchMock(...args) }));vi.mock('./heldCheckoutRecovery.js', () => ({ preserveMergedCheckout: (...args) => preserveCheckoutMock(...args) }));const completionOwnersMock = vi.fn(async () => []);@@ -85,10 +86,10 @@ describe('completed branch archival boundary', () => {stdout: args.includes('--git-common-dir') ? '/repo/.git' : '', exitCode: 0,}));getDefaultBranchMock.mockResolvedValue('main');- preserveBranchMock.mockReset().mockResolvedValue({ archiveDir: '/branch-archive', verify: async () => true });+ preserveBranchMock.mockReset().mockResolvedValue(preservedBranch());});afterEach(() => {- preserveBranchMock.mockReset().mockResolvedValue({ archiveDir: '/branch-archive', verify: async () => true });+ preserveBranchMock.mockReset().mockResolvedValue(preservedBranch());});it('runs the trusted receiver guard after archival verification and preserves its refusal reason without pushing', async () => {let ready = false;diff --git a/server/services/worktreeReap.test.js b/server/services/worktreeReap.test.jsindex 10ec99eb03..da4dfc91f2 100644--- a/server/services/worktreeReap.test.js+++ b/server/services/worktreeReap.test.js@@ -17,6 +17,7 @@ import { createHash } from 'crypto';import { tmpdir } from 'os';import { join } from 'path';import { execGit } from '../lib/execGit.js';+import * as gitExecution from '../lib/execGit.js';import {materializeGitRepo,resetGitSandbox,@@ -105,13 +106,117 @@ describe.skipIf(SKIP_HEAVY_INTEGRATION)('local completed ref retirement', () =>beforeEach(async () => { ({ dir } = await initRepo()); });afterEach(async () => { await rm(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 }); });+ it('archives exact configuration and recreates the retired name without inherited settings', async () => {+ const branch = 'claim/issue-42.topic';+ await execGit(['branch', branch], dir);+ const head = (await execGit(['rev-parse', branch], dir)).stdout.trim();+ await execGit(['remote', 'add', 'origin', '.'], dir);+ await execGit(['update-ref', 'refs/remotes/origin/main', head], dir);+ for (const [key, value] of [+ ['remote', 'origin'], ['merge', 'refs/heads/old'], ['rebase', 'true'],+ ['pushRemote', 'origin'], ['description', 'first line\nsecond line'], ['mergeOptions', '--no-ff'], ['mergeOptions', '--no-edit'],+ ]) await execGit(['config', '--add', `branch.${branch}.${key}`, value], dir);+ await execGit(['config', 'branch.other.remote', 'keep'], dir);+ await execGit(['config', `branch.${branch}.child.remote`, 'also-keep'], dir);+ const common = (await execGit(['rev-parse', '--path-format=absolute', '--git-common-dir'], dir)).stdout.trim();+ const original = await readFile(join(common, 'config'));+ expect(await deleteCompletedLocalBranch(dir, branch, head)).toBe(true);+ const archives = join(PATHS.cos, 'branch-retirement-archives');+ const archive = (await Promise.all((await readdir(archives)).map(async id => ({+ path: join(archives, id), manifest: JSON.parse(await readFile(join(archives, id, 'manifest.json'), 'utf8')),+ })))).find(entry => entry.manifest.repoPath === dir);+ expect(await readFile(join(archive.path, 'config'))).toEqual(original);+ expect(archive.manifest.configuration.identity.sha256).toBe(createHash('sha256').update(original).digest('hex'));+ if (process.platform !== 'win32') expect((await lstat(join(archive.path, 'config'))).mode & 0o077).toBe(0);+ expect(await readFile(join(common, 'config'))).toEqual(await readFile(join(archive.path, 'config.retired')));+ expect((await execGit(['config', 'branch.other.remote'], dir)).stdout.trim()).toBe('keep');+ expect((await execGit(['config', `branch.${branch}.child.remote`], dir)).stdout.trim()).toBe('also-keep');+ const fresh = join(dir, 'fresh');+ await execGit(['worktree', 'add', '--no-track', '-b', branch, fresh, 'origin/main'], dir);+ expect((await execGit(['config', '--get-regexp', '^branch\\.claim/issue-42\\.topic\\.[^.]+$'], fresh, { ignoreExitCode: true })).exitCode).toBe(1);+ expect((await execGit(['rev-parse', '--verify', '@{upstream}'], fresh, { ignoreExitCode: true })).exitCode).not.toBe(0);+ await execGit(['branch', '--track', 'explicit', 'origin/main'], dir);+ expect((await execGit(['config', 'branch.explicit.merge'], dir)).stdout.trim()).toBe('refs/heads/main');+ });++ it('holds the ref and live settings when configuration changes after preservation', async () => {+ await execGit(['branch', 'done'], dir);+ await execGit(['config', 'branch.done.remote', 'old'], dir);+ const head = (await execGit(['rev-parse', 'done'], dir)).stdout.trim();+ expect(await deleteCompletedLocalBranch(dir, 'done', head, {+ beforeMutation: () => execGit(['config', 'branch.done.remote', 'new'], dir),+ })).toBe(false);+ expect((await execGit(['rev-parse', 'done'], dir)).stdout.trim()).toBe(head);+ expect((await execGit(['config', 'branch.done.remote'], dir)).stdout.trim()).toBe('new');+ });++ it('preserves configuration when the receiver recreates the deleted branch at the same head', async () => {+ await execGit(['branch', 'done'], dir);+ await execGit(['config', 'branch.done.remote', 'keep'], dir);+ const head = (await execGit(['rev-parse', 'done'], dir)).stdout.trim();+ const common = (await execGit(['rev-parse', '--path-format=absolute', '--git-common-dir'], dir)).stdout.trim();+ await writeFile(join(common, 'hooks', 'post-receive'), `#!/bin/sh\ngit update-ref refs/heads/done ${head}\n`, { mode: 0o755 });+ expect(await deleteCompletedLocalBranch(dir, 'done', head)).toBe(false);+ expect((await execGit(['rev-parse', 'done'], dir)).stdout.trim()).toBe(head);+ expect((await execGit(['config', 'branch.done.remote'], dir)).stdout.trim()).toBe('keep');+ });++ it('preserves changed configuration even when a receiver hook bypasses the native config lock', async () => {+ await execGit(['branch', 'done'], dir);+ await execGit(['config', 'branch.done.remote', 'keep'], dir);+ const head = (await execGit(['rev-parse', 'done'], dir)).stdout.trim();+ const common = (await execGit(['rev-parse', '--path-format=absolute', '--git-common-dir'], dir)).stdout.trim();+ await writeFile(join(common, 'hooks', 'post-receive'), '#!/bin/sh\ncat >> config <<\'EOF\'\n[branch "done"]\nremote = new\nEOF\n', { mode: 0o755 });+ expect(await deleteCompletedLocalBranch(dir, 'done', head)).toBe(false);+ expect((await execGit(['config', 'branch.done.remote'], dir)).stdout.trim()).toBe('new');+ });++ it('refuses branch settings supplied by an included file', async () => {+ await execGit(['branch', 'done'], dir);+ const head = (await execGit(['rev-parse', 'done'], dir)).stdout.trim();+ const included = join(dir, 'branch-settings');+ await writeFile(included, '[branch "done"]\n\tremote = keep\n');+ await execGit(['config', 'include.path', included], dir);+ expect(await deleteCompletedLocalBranch(dir, 'done', head)).toBe(false);+ expect((await execGit(['rev-parse', 'done'], dir)).stdout.trim()).toBe(head);+ expect(await readFile(included, 'utf8')).toBe('[branch "done"]\n\tremote = keep\n');+ });++ it('retains configuration on an uncertain receiver outcome', async () => {+ await execGit(['branch', 'done'], dir);+ await execGit(['config', 'branch.done.remote', 'keep'], dir);+ const head = (await execGit(['rev-parse', 'done'], dir)).stdout.trim();+ const execute = gitExecution.execGit;+ const receiver = vi.spyOn(gitExecution, 'execGit').mockImplementation((args, ...rest) => args[0] === 'push'+ ? Promise.resolve({ exitCode: null, signal: 'SIGTERM', terminated: true, stdout: '', stderr: '' })+ : execute(args, ...rest));+ try { expect(await deleteCompletedLocalBranch(dir, 'done', head)).toBe(false); }+ finally { receiver.mockRestore(); }+ expect((await execGit(['rev-parse', 'done'], dir)).stdout.trim()).toBe(head);+ expect((await execGit(['config', 'branch.done.remote'], dir)).stdout.trim()).toBe('keep');+ });++ it.each(['config.lock', 'refs/heads/done.lock'])('preserves another writer\'s %s and live settings', async lock => {+ await execGit(['branch', 'done'], dir);+ await execGit(['config', 'branch.done.remote', 'keep'], dir);+ const head = (await execGit(['rev-parse', 'done'], dir)).stdout.trim();+ const common = (await execGit(['rev-parse', '--path-format=absolute', '--git-common-dir'], dir)).stdout.trim();+ await writeFile(join(common, lock), 'another writer');+ expect(await deleteCompletedLocalBranch(dir, 'done', head)).toBe(false);+ expect(await readFile(join(common, lock), 'utf8')).toBe('another writer');+ expect((await execGit(['rev-parse', 'done'], dir)).stdout.trim()).toBe(head);+ expect((await execGit(['config', 'branch.done.remote'], dir)).stdout.trim()).toBe('keep');+ });+it('uses an exact-head lease and native holder refusal for a late attachment', async () => {await execGit(['branch', 'done'], dir);+ await execGit(['config', 'branch.done.remote', 'keep'], dir);const head = (await execGit(['rev-parse', 'done'], dir)).stdout.trim();const path = join(dir, 'late-holder');await execGit(['worktree', 'add', path, 'done'], dir);expect(await deleteCompletedLocalBranch(dir, 'done', head)).toBe(false);expect((await execGit(['rev-parse', 'done'], dir)).stdout.trim()).toBe(head);+ expect((await execGit(['config', 'branch.done.remote'], dir)).stdout.trim()).toBe('keep');await execGit(['worktree', 'remove', path], dir);expect(await deleteCompletedLocalBranch(dir, 'done', head)).toBe(true);});@@ -198,7 +303,7 @@ describe.skipIf(SKIP_HEAVY_INTEGRATION)('local completed ref retirement', () =>expect((await execGit(['rev-parse', 'done'], dir)).stdout.trim()).toBe(head);});- it.each(['reflog', 'commits.bundle', 'manifest.json'])('refuses an archive whose %s changes before retirement', async name => {+ it.each(['reflog', 'commits.bundle', 'manifest.json', 'config', 'config.retired'])('refuses an archive whose %s changes before retirement', async name => {await execGit(['branch', 'done'], dir);const head = (await execGit(['rev-parse', 'done'], dir)).stdout.trim();const common = (await execGit(['rev-parse', '--path-format=absolute', '--git-common-dir'], dir)).stdout.trim();@@ -220,10 +325,12 @@ describe.skipIf(SKIP_HEAVY_INTEGRATION)('local completed ref retirement', () =>it('preserves the repository receiver deletion policy', async () => {await execGit(['branch', 'done'], dir);+ await execGit(['config', 'branch.done.remote', 'keep'], dir);const head = (await execGit(['rev-parse', 'done'], dir)).stdout.trim();await execGit(['config', 'receive.denyDeletes', 'true'], dir);expect(await deleteCompletedLocalBranch(dir, 'done', head)).toBe(false);expect((await execGit(['rev-parse', 'done'], dir)).stdout.trim()).toBe(head);+ expect((await execGit(['config', 'branch.done.remote'], dir)).stdout.trim()).toBe('keep');});});