cfg/bin/git-c
Knut Ahlers 651684ef56
Add support for key::... public key format
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2024-01-02 13:28:33 +01:00

30 lines
691 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
source "${HOME}/bin/script_framework.sh"
### Fix committer email by repo
step "Ensure correct commit config..."
git committerconfig
### Commit
signingkey=$(git config user.signingkey)
if [[ $signingkey =~ ^(ssh|ecdsa|key::) ]]; then
step "Loading ssh key into agent..."
vault-sshadd $(cut -d ' ' -f 3 <<<"${signingkey}")
else
step "Loading passphrase for GPG key..."
vault-gpg ${signingkey}
fi
step "Execute pre-commit auto-hook"
git autohook pre-commit
step "Issuing commit..."
COMMIT_OPTS=$(git config --get commit.cliopts 2>/dev/null || echo "")
git commit -v ${COMMIT_OPTS} "$@"
step "Execute post-commit auto-hook"
git autohook post-commit