Skip to content

useGpgSignerAuthor reads the last commit's signer, which is empty on a squash-merged branch, so it falls back to user.name #68

Closed

Description

@Shinrai

Problem

useGpgSignerAuthor (--use-gpg-signer-author) takes the author from git log -1 --format=%GS, the signer of the last commit. On a v4 next branch that commit is almost always a squash merge made by GitHub or the release bot, whose signature can't be verified locally, so %GS is empty and the author falls back to git config user.name:

signing key:  B9C512AC985D8BFE — Nate Corcoran (2023 PC) <[email protected]>
last commit:  5c08d48, author "Nathaniel H", %G? = E (can't check), %GS = ""
@Author:      Shinrai <CLDMV>          ← user.name
expected:     Nate Corcoran <CLDMV>

Found in the CLDMV header-uniformity smoke test on jsonv-vscode's next: every author and last-modified identity came out as Shinrai <CLDMV>.

Fix

Read the name from the key git is configured to sign with, which describes whoever runs the tool regardless of the last commit:

  • user.signingkey, when gpg.format is unset or openpgp;
  • list it with gpg.openpgp.program / gpg.program / gpg (--batch --with-colons --list-keys) and take the first user ID that is not revoked or expired, decoding GnuPG's \xNN escapes;
  • parse it with the existing parseSignerUid (drops the UID comment).

Fall back to the current behaviour (last commit's %GS, then user.name, then the log author) when there is no readable OpenPGP signing key: none configured, SSH/X.509 signing, or gpg missing / not knowing the key.

Tests

  • Stand-in gpg output for every branch: key wins over %GS, revoked/expired UIDs skipped, escapes decoded, SSH signing / no key / missing gpg / empty or unusable listing fall back, gpg.openpgp.program over gpg.program, end-to-end header with company: "CLDMV".
  • Isolate the suite from the developer's global/system git config, so a real signing key (or commit.gpgsign, user.name) on the machine running the tests can't change results.
  • One environment test that checks the lookup against the real git config and gpg on the machine running the suite, with the expected value derived once per test run and the test skipped where no key is configured.

Activity

  1. added
    type: bug
    priority: high
    area: core
    status: in progress
    status: implemented
    and removed
    status: in progress
    on Sep 29, 2026
  2. cldmv-bot commented on Sep 29, 2026

    @cldmv-bot
    Contributor

    Closed in v2.0.0 — resolved by #69.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: corepriority: highstatus: implementedtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions