summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarc Cornellà <hello@mcornella.com>2021-11-10 11:35:17 +0100
committerMarc Cornellà <hello@mcornella.com>2021-11-10 11:35:17 +0100
commit1d166eaaa138d7413365205c61412ccb68286b3a (patch)
tree854e6dfeafbd7574f804c45f69d78ae020534ae9 /lib
parente3f7b8aa570a09186a7e3d1877b36d7e43d39197 (diff)
downloadzsh-1d166eaaa138d7413365205c61412ccb68286b3a.tar.gz
zsh-1d166eaaa138d7413365205c61412ccb68286b3a.tar.bz2
zsh-1d166eaaa138d7413365205c61412ccb68286b3a.zip
fix(cli): avoid `git -C` for compatibility with git < v1.8.5 (#10404)
Diffstat (limited to 'lib')
-rw-r--r--lib/cli.zsh11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/cli.zsh b/lib/cli.zsh
index 2975acb91..d90cc6469 100644
--- a/lib/cli.zsh
+++ b/lib/cli.zsh
@@ -36,7 +36,7 @@ function _omz {
elif (( CURRENT == 3 )); then
case "$words[2]" in
changelog) local -a refs
- refs=("${(@f)$(command git -C "$ZSH" for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
+ refs=("${(@f)$(cd "$ZSH"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
_describe 'command' refs ;;
plugin) subcmds=(
'disable:Disable plugin(s)'
@@ -171,9 +171,12 @@ EOF
function _omz::changelog {
local version=${1:-HEAD} format=${3:-"--text"}
- if ! command git -C "$ZSH" show-ref --verify refs/heads/$version &>/dev/null && \
- ! command git -C "$ZSH" show-ref --verify refs/tags/$version &>/dev/null && \
- ! command git -C "$ZSH" rev-parse --verify "${version}^{commit}" &>/dev/null; then
+ if (
+ cd "$ZSH"
+ ! command git show-ref --verify refs/heads/$version && \
+ ! command git show-ref --verify refs/tags/$version && \
+ ! command git rev-parse --verify "${version}^{commit}"
+ ) &>/dev/null; then
cat >&2 <<EOF
Usage: omz changelog [version]