mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-25 08:48:08 +02:00
fix(git): disable gpg signing for ktx's own commits (#299)
ktx commits under a synthetic identity (ktx <ktx@example.com>) that can never own a GPG secret key. On a machine with commit.gpgsign=true, git tried to sign every ktx commit and failed with "No secret key", breaking ingest, scan, wiki, memory, and bootstrap commits. Inject commit.gpgsign=false as a per-invocation -c override in the single core git client factory every ktx commit flows through. This honors the existing principle of not mutating the user's repo config, and is locale-independent (no error-message matching). Also harden the repo-isolation fixture helper to disable signing on its raw commits so the suite is deterministic regardless of the contributor's global git config. Fixes KLO-735. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e4e7b40c23
commit
9587049283
3 changed files with 29 additions and 2 deletions
|
|
@ -31,6 +31,10 @@ function sanitizedGitEnv(env: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEn
|
|||
* directory is an existing repo ktx did not create and the machine has no configured git
|
||||
* identity (e.g. a fresh Mac with no ~/.gitconfig), without mutating the user's repo config.
|
||||
* Explicit `--author` flags on individual commits still take precedence over GIT_AUTHOR_NAME.
|
||||
*
|
||||
* `commit.gpgsign=false` is injected as a per-invocation `-c` override so ktx's commits never
|
||||
* attempt GPG signing: ktx commits under a synthetic identity that can never own a secret key, so
|
||||
* a user's `commit.gpgsign=true` would otherwise fail every commit with "No secret key".
|
||||
*/
|
||||
export function createSimpleGit(baseDir: string, identity?: { name: string; email: string }): SimpleGit {
|
||||
const env = sanitizedGitEnv();
|
||||
|
|
@ -40,5 +44,5 @@ export function createSimpleGit(baseDir: string, identity?: { name: string; emai
|
|||
env.GIT_COMMITTER_NAME = identity.name;
|
||||
env.GIT_COMMITTER_EMAIL = identity.email;
|
||||
}
|
||||
return simpleGit({ baseDir, unsafe: { allowUnsafeAskPass: true } }).env(env);
|
||||
return simpleGit({ baseDir, config: ['commit.gpgsign=false'], unsafe: { allowUnsafeAskPass: true } }).env(env);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue