From 3bd25ebc843100c12199a42a21623d04fcdcd4a7 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Wed, 13 Sep 2023 14:55:36 +0200 Subject: [PATCH] Temporarily disable signing ... ... if the proper GPG key is not available, e.g., on a server. Then, it does not make sense to push the updates to the forked repo. --- .config/shell/utils.d/update.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.config/shell/utils.d/update.sh b/.config/shell/utils.d/update.sh index 9022230..e320562 100644 --- a/.config/shell/utils.d/update.sh +++ b/.config/shell/utils.d/update.sh @@ -100,9 +100,25 @@ _update_omz_fork() { # Keep our personal "oh-my-zsh" fork up-to-date # See: https://code.webartifex.biz/alexander/oh-my-zsh - git rebase --quiet master - git push --quiet fork forked --force - git push --quiet fork master + # Note: Without a proper GPG key, the rebasing is done without signing + + # First, check if `gpg` exists and works in general + # as it might not be set up on some servers + if _command_exists gpg; then + gpg --list-keys > /dev/null + rv=$? + else + rv=1 + fi + + if [ $rv -eq 0 ] && [ $(gpg --list-keys | grep "AB5C0E319D77350FBA6CF143344EA5AB10D868E0") ]; then + git rebase --quiet master + # Only push a properly rebased and signed fork + git push --quiet fork forked --force + git push --quiet fork master + else + git -c commit.gpgsign=false rebase --quiet master + fi cd $cwd }