f1a5fb5ee99f51f06a18b7b0ffecd8763f8d96d6

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(cli): fix `commit.gpgsign` test in `omz pr test`

Since `set -e` is enabled, when `commit.gpgsign` is not set the
`git config` command would show an error. Given that it is technically
not ignored, the subshell would exit.

With this change, the `commit.gpgsign` setting is properly tested
by doing the fallback test if the command fails, so no exit status
code ends up quiting the subshell.

Diff

 1diff --git a/lib/cli.zsh b/lib/cli.zsh
 2index bf783d9f34cc5200890865384a44502520774bf3..56d5b91de886c56c34590142194269546eb735af 100644
 3--- a/lib/cli.zsh
 4+++ b/lib/cli.zsh
 5@@ -578,8 +578,9 @@ function _omz::pr::test {
 6       # Back up commit.gpgsign setting: use --local to get the current repository
 7       # setting, not the global one. If --local is not a known option, it will
 8       # exit with a 129 status code.
 9-      gpgsign=$(command git config --local commit.gpgsign 2>/dev/null)
10-      [[ $? -ne 129 ]] || gpgsign=$(command git config commit.gpgsign 2>/dev/null)
11+      if ! gpgsign=$(command git config --local commit.gpgsign 2>/dev/null); then
12+        [[ $? -ne 129 ]] || gpgsign=$(command git config commit.gpgsign 2>/dev/null)
13+      fi
14       command git config commit.gpgsign false
15 
16       command git rebase master ohmyzsh/pull-$1 || {