From e67c27b32259c012a8fbb83ad1c3d29e3e5577b1 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Fri, 23 Oct 2026 14:15:06 -0500 Subject: [PATCH] row 283 (#1788): webby-0236 E5: the git round-trip test drops GIT_DIR, GIT_WORK_TREE, GIT_COMMON_DIR and GIT_INDEX_FILE and reads no global or system config (repo convention); BUILD.md records E5. Untested --- agents/honker/work/queue-283/BUILD.md | 9 +++++++++ packages/library/tests/mapping.test.mjs | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/agents/honker/work/queue-283/BUILD.md b/agents/honker/work/queue-283/BUILD.md index 937fc888e..94dbca495 100644 --- a/agents/honker/work/queue-283/BUILD.md +++ b/agents/honker/work/queue-283/BUILD.md @@ -177,3 +177,12 @@ M6c now replaces the whole end check (this supersedes the earlier M6c row): |---|---|---|---|---| | M6c | src/mapping.mjs | `if (value.trim() !== value \|\| IDENT_CRUD_END.test(value))` | `if (false)` | mapping.test "editor is optional" (end cases) | | M6d | src/mapping.mjs | `if (value.trim() !== value \|\| IDENT_CRUD_END.test(value))` | `if (value.trim() !== value)` | mapping.test "editor is optional" (`,` `:` `;` `"` `'` `\` cases) | + +## 2026-10-23 E5 (webby-0236, not blocking), fixed + +The round-trip test stripped only GIT_AUTHOR_* and GIT_COMMITTER_*. With GIT_DIR, GIT_WORK_TREE or +GIT_INDEX_FILE set (inside a hook, say), GIT_DIR beats `-C root` and the commit would land in the +outer repo, and the test read global and system config. It now deletes GIT_DIR, GIT_WORK_TREE, +GIT_COMMON_DIR and GIT_INDEX_FILE (as queue/tests/helpers.mjs gitEnv does) and sets +GIT_CONFIG_GLOBAL=/dev/null and GIT_CONFIG_NOSYSTEM=1 (as ledger.test.mjs does). The `-c user.*` +ident still applies. Test only; no mutant changes. diff --git a/packages/library/tests/mapping.test.mjs b/packages/library/tests/mapping.test.mjs index f446d3d82..eab575809 100644 --- a/packages/library/tests/mapping.test.mjs +++ b/packages/library/tests/mapping.test.mjs @@ -145,8 +145,11 @@ test('C2-01d: an accepted editor round-trips through a real git commit unchanged const editor = mapping(e => ({ ...e, editor: { name: 'Doe, Jane Q.', email: 'jane.doe@example.invalid.' } })).editor; const root = mkdtempSync(join(tmpdir(), 'library-ident-')); t.after(() => rmSync(root, { recursive: true, force: true })); - // An ident in the environment would win over -c, so the commit runs without one. + // An ident in the environment would win over -c, so the commit runs without one. GIT_DIR and its + // family would beat -C (inside a hook, say), and git reads no global or system config (webby-0236 E5). const env = Object.fromEntries(Object.entries(process.env).filter(([k]) => !/^GIT_(AUTHOR|COMMITTER)_/.test(k))); + for (const k of ['GIT_DIR', 'GIT_WORK_TREE', 'GIT_COMMON_DIR', 'GIT_INDEX_FILE']) delete env[k]; + Object.assign(env, { GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' }); const git = (...args) => execFileSync('git', ['-c', `user.name=${editor.name}`, '-c', `user.email=${editor.email}`, '-c', 'commit.gpgsign=false', '-c', 'core.hooksPath=/dev/null', '-C', root, ...args], { encoding: 'utf8', env }); git('init', '-q');