Skip to content

Commit

Permalink
fix(plugins/git): code quality improve by de-duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
dalisoft committed Mar 1, 2024
1 parent d6ed93a commit fdca427
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions plugins/git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,14 @@ cleanup() {
git config --local --unset gpg.program
log_verbose "Git GPG sign unset"
fi
if [[ -z "${GPG_NO_SIGN-}" && -n "${CI-}" && -n "${GPG_PASSPHRASE-}" ]]; then
if [[ -z "${GPG_NO_SIGN-}" && -n "${GPG_KEY_ID-}" && -n "${GPG_PASSPHRASE-}" ]]; then
gpg --quiet --passphrase "$GPG_PASSPHRASE" --batch --yes --delete-secret-and-public-key "$GPG_KEY_ID"
log_verbose "Git GPG key deleted"

fi
if [[ -z "${GPG_NO_SIGN-}" && -n "${CI-}" ]]; then
rm -rf ~/.gnupg/gpg-agent.conf
rm -rf ~/.gnupg/gpg.conf
log_verbose "Git GPG config cleanup"
elif [[ -z "${GPG_NO_SIGN-}" && -n "${GPG_KEY_ID-}" ]]; then
gpg --quiet --passphrase "$GPG_PASSPHRASE" --batch --yes --delete-secret-and-public-key "$GPG_KEY_ID"
log_verbose "Git GPG key deleted"
fi

log_verbose "Git config cleanup"
Expand Down

0 comments on commit fdca427

Please sign in to comment.