repositories / will

will

owned by bugabinga

style: biome formatting for hermetic git identity helper

661d434a2cf0b0c2b2e4b090249b1493d49ac35e

Oliver Jan Krylow <oliver@bugabinga.net> ·

SSH signature · not checked

Browse filesCompare with HEAD

Changed files (1)

+10 / −11 text lines

Diff layout

src/agent/runtime.int.test.ts

Modified

+10 / −11 text lines

2222const exec = promisify(execFile)
2424/** committer identity and signing must not depend on the machine's global git config (CI has none) */
25const GIT_IDENTITY = [
26 '-c',
27 'user.name=t',
28 '-c',
29 'user.email=t@t',
30 '-c',
31 'commit.gpgsign=false',
32]
25const GIT_IDENTITY = ['-c', 'user.name=t', '-c', 'user.email=t@t', '-c', 'commit.gpgsign=false']
3427test('worktree: clone, ff-only when clean, preserved when dirty or ahead', async () => {
3528 const dir = await mkdtemp(join(tmpdir(), 'wt-'))
5851 // dirty worktree: preserved, no ff, reported
5952 await writeFile(join(work, 'b.txt'), 'local\n')
6053 await writeFile(join(seed, 'a.txt'), 'three\n')
61 await exec('git', [...GIT_IDENTITY, 'commit', '-am', 'three', '--author', 't <t@t>'], { cwd: seed })
54 await exec('git', [...GIT_IDENTITY, 'commit', '-am', 'three', '--author', 't <t@t>'], {
55 cwd: seed,
56 })
6257 await exec('git', ['push', 'origin', 'trunk'], { cwd: seed })
6358 const s3 = await syncWorktree(work, remote, 'trunk')
6459 assert.equal(s3.dirty, true)
6863 // ahead commits: diverged, preserved
6964 await exec('git', ['add', '.'], { cwd: work })
70 await exec('git', [...GIT_IDENTITY, 'commit', '-m', 'local', '--author', 't <t@t>'], { cwd: work })
65 await exec('git', [...GIT_IDENTITY, 'commit', '-m', 'local', '--author', 't <t@t>'], {
66 cwd: work,
67 })
7168 const s4 = await syncWorktree(work, remote, 'trunk')
7269 assert.equal(s4.diverged, true)
7370})
9390 // a local commit moves HEAD; the read reports it without merging origin
9491 await writeFile(join(work, 'b.txt'), 'local\n')
9592 await exec('git', ['add', '.'], { cwd: work })
96 await exec('git', [...GIT_IDENTITY, 'commit', '-m', 'local', '--author', 't <t@t>'], { cwd: work })
93 await exec('git', [...GIT_IDENTITY, 'commit', '-m', 'local', '--author', 't <t@t>'], {
94 cwd: work,
95 })
9796 const s2 = await readWorktreeState(work)
9897 assert.equal(s2.head, (await head()).stdout.trim())
9998 assert.notEqual(s2.head, s1.head)