git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git rev-list fails to verify ssh-signed commits (but git log works)

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 9, 2023, 16:44 UTC
Message-ID
<xmqqpmaiokk8.fsf@gitster.g>
In-Reply-To
<Y+TqEM21o+3TGx6D@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 7 quoted lines
> I'd be more worried about correctness (command "foo" must not parse
> option "bar" because it is plumbing and must use the default). But
> looking over the options, I really don't see anything like that. The one
> I'd expect (or worry most about) is "we do/do not bother to enable
> signatures at all based on config" but I don't think that is the case.
> We default use_format to &gpg_format[0], so there is always a signature
> format defined, even if the config is skipped.

I arrived at the same conclusion after seeing what these configuration affected. If some plumbing codepaths should avoid certain gpg-interface features, I didn't see a good reason for them to be calling into gpg-interface.c functions (e.g. that would have meant that "rev-list '--format=%G'" should have errored out with a "%G is only available in log but not in rev-list which is a plumbing" error message) and at that point reading configuration is much lessor problem.

Show 7 quoted lines
> If the gpg code used git_config_get_string(), etc, then they could just
> access each key on demand (efficiently, from an internal hash table),
> which reduces the risk of "oops, we forgot to initialize the config
> here". It does probably mean restructuring the code a little, though
> (since you'd often have an accessor function to get "foo.bar" rather
> than assuming "foo.bar" was parsed into an enum already, etc). That may
> not be worth the effort (and risk of regression) to convert.

Yup. Care must be taken not to break "-u <keyid>" that is set via calling set_signing_key() directly, which assumes that the default key is already set from the config earlier, but the resulting code may make it clearer that our rule is "command line first, and then peek into configuration as a fallback value", if we did such a conversion.

Thanks.
Previous: Jeff KingNext: Junio C Hamano
Message 19 of 20 in “git rev-list fails to verify ssh-signed commits (but git log works)”
  1. Max GautierFeb 8, 2023
  2. Jeff KingFeb 8, 2023
  3. Junio C HamanoFeb 8, 2023
  4. Junio C HamanoFeb 8, 2023
  5. gpg-interface: lazily initialize and read the configurationJunio C Hamano, Feb 8, 2023
  6. Ævar Arnfjörð BjarmasonFeb 9, 2023
  7. Junio C HamanoFeb 9, 2023
  8. Ævar Arnfjörð BjarmasonFeb 9, 2023
  9. Jeff KingFeb 9, 2023
  10. Junio C HamanoFeb 9, 2023
  11. gpg-interface: lazily initialize and read the configurationJunio C Hamano, Feb 9, 2023
  12. Jeff KingFeb 26, 2023
  13. Junio C HamanoFeb 27, 2023
  14. Ævar Arnfjörð BjarmasonMar 8, 2023
  15. Jeff KingMar 9, 2023
  16. Junio C HamanoMar 9, 2023
  17. Jeff KingMar 10, 2023
  18. Jeff KingFeb 9, 2023
  19. Junio C HamanoFeb 9, 2023
  20. Junio C HamanoFeb 8, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.