diff options
author | Carlo Sala <carlosalag@protonmail.com> | 2022-03-31 09:27:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 09:27:58 +0200 |
commit | 141d06b602b670638a6354e05686e5d3bc56d1a6 (patch) | |
tree | b805e5687d57be09fbeb1e0c82fb4d1d30d8d358 /lib | |
parent | 93435bff4947ca0855d4d8ecc4786877578f0dd3 (diff) | |
download | zsh-141d06b602b670638a6354e05686e5d3bc56d1a6.tar.gz zsh-141d06b602b670638a6354e05686e5d3bc56d1a6.tar.bz2 zsh-141d06b602b670638a6354e05686e5d3bc56d1a6.zip |
fix(cli): turn of `commit.gpgsign` compatibly with git v1.7.1 (#10679)
Co-authored-by: Marc Cornellà <hello@mcornella.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cli.zsh | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/lib/cli.zsh b/lib/cli.zsh index c2fba8556..bf783d9f3 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -573,12 +573,27 @@ function _omz::pr::test { # Rebase pull request branch against the current master _omz::log info "rebasing PR #$1..." - command git rebase --no-gpg-sign master ohmyzsh/pull-$1 || { - command git rebase --abort &>/dev/null - _omz::log warn "could not rebase PR #$1 on top of master." - _omz::log warn "you might not see the latest stable changes." - _omz::log info "run \`zsh\` to test the changes." - return 1 + local gpgsign + { + # Back up commit.gpgsign setting: use --local to get the current repository + # setting, not the global one. If --local is not a known option, it will + # exit with a 129 status code. + gpgsign=$(command git config --local commit.gpgsign 2>/dev/null) + [[ $? -ne 129 ]] || gpgsign=$(command git config commit.gpgsign 2>/dev/null) + command git config commit.gpgsign false + + command git rebase master ohmyzsh/pull-$1 || { + command git rebase --abort &>/dev/null + _omz::log warn "could not rebase PR #$1 on top of master." + _omz::log warn "you might not see the latest stable changes." + _omz::log info "run \`zsh\` to test the changes." + return 1 + } + } always { + case "$gpgsign" in + "") command git config --unset commit.gpgsign ;; + *) command git config commit.gpgsign "$gpgsign" ;; + esac } _omz::log info "fetch of PR #${1} successful." |