]> Kevux Git Server - rit/commit
gpg-interface: allow sign_buffer() to use default signing key
authorJustin Tobler <jltobler@gmail.com>
Fri, 13 Mar 2026 01:39:37 +0000 (20:39 -0500)
committerJunio C Hamano <gitster@pobox.com>
Fri, 13 Mar 2026 04:28:20 +0000 (21:28 -0700)
commit86ebf870b909a7f4707aa2601d290bc992d21a53
tree9056a0624020917e9eb4c88020cf11a8fe479121
parent233545cc60315863fea3fa17e2df86de23a6a4f7
gpg-interface: allow sign_buffer() to use default signing key

The `sign_commit_to_strbuf()` helper in "commit.c" provides fallback
logic to get the default configured signing key when a key is not
provided and handles generating the commit signature accordingly. This
signing operation is not really specific to commits as any arbitrary
buffer can be signed. Also, in a subsequent commit, this same logic is
reused by git-fast-import(1) when signing commits with invalid
signatures.

Remove the `sign_commit_to_strbuf()` helper from "commit.c" and extend
`sign_buffer()` in "gpg-interface.c" to support using the default key as
a fallback when the `SIGN_BUFFER_USE_DEFAULT_KEY` flag is provided. Call
sites are updated accordingly.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/tag.c
commit.c
gpg-interface.c
gpg-interface.h
send-pack.c