+# So if you want to sign with multiple subkeys, then set it up with multiple
+# local-user directives in ~/.gnupg/gpg.conf & set EXIM_KEY=default in environ.
+
+if repo_signing_key="$(git config user.signingkey)"; then
+ : "${EXIM_KEY:=$repo_signing_key}"
+else
+ if [ ".${EXIM_KEY:-}" = "." ]; then
+ warn "no EXIM_KEY found, trusting local gpg config"
+ fi
+fi
+
+case "${EXIM_KEY:-default}" in
+default|DEFAULT)
+ gpg_sign() { ${GPG_COMMAND} --detach-sig --armor "${1:?}" ; }
+ ;;
+*)
+ gpg_sign() { ${GPG_COMMAND} --local-user "${EXIM_KEY}" --detach-sig --armor "${1:?}" ; }
+ ;;
+esac