1d166eaaa138d7413365205c61412ccb68286b3a
- Author
- Marc Cornellà <hello@mcornella.com>
- Committer
- Marc Cornellà <hello@mcornella.com>
- Date
Message
fix(cli): avoid `git -C` for compatibility with git < v1.8.5 (#10404)
Diff
1diff --git a/lib/cli.zsh b/lib/cli.zsh
2index 2975acb914a56593f792c0b3bf08d677da24099f..d90cc64699d91d629fc59713b050759350fcddcf 100644
3--- a/lib/cli.zsh
4+++ b/lib/cli.zsh
5@@ -36,7 +36,7 @@ function _omz {
6 elif (( CURRENT == 3 )); then
7 case "$words[2]" in
8 changelog) local -a refs
9- refs=("${(@f)$(command git -C "$ZSH" for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
10+ refs=("${(@f)$(cd "$ZSH"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
11 _describe 'command' refs ;;
12 plugin) subcmds=(
13 'disable:Disable plugin(s)'
14@@ -171,9 +171,12 @@ EOF
15 function _omz::changelog {
16 local version=${1:-HEAD} format=${3:-"--text"}
17
18- if ! command git -C "$ZSH" show-ref --verify refs/heads/$version &>/dev/null && \
19- ! command git -C "$ZSH" show-ref --verify refs/tags/$version &>/dev/null && \
20- ! command git -C "$ZSH" rev-parse --verify "${version}^{commit}" &>/dev/null; then
21+ if (
22+ cd "$ZSH"
23+ ! command git show-ref --verify refs/heads/$version && \
24+ ! command git show-ref --verify refs/tags/$version && \
25+ ! command git rev-parse --verify "${version}^{commit}"
26+ ) &>/dev/null; then
27 cat >&2 <<EOF
28 Usage: omz changelog [version]
29