mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-19 02:41:57 +00:00
fix(cli): avoid git -C
for compatibility with git < v1.8.5 (#10404)
This commit is contained in:
parent
e3f7b8aa57
commit
1d166eaaa1
1 changed files with 7 additions and 4 deletions
11
lib/cli.zsh
11
lib/cli.zsh
|
@ -36,7 +36,7 @@ function _omz {
|
||||||
elif (( CURRENT == 3 )); then
|
elif (( CURRENT == 3 )); then
|
||||||
case "$words[2]" in
|
case "$words[2]" in
|
||||||
changelog) local -a refs
|
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 ;;
|
_describe 'command' refs ;;
|
||||||
plugin) subcmds=(
|
plugin) subcmds=(
|
||||||
'disable:Disable plugin(s)'
|
'disable:Disable plugin(s)'
|
||||||
|
@ -171,9 +171,12 @@ EOF
|
||||||
function _omz::changelog {
|
function _omz::changelog {
|
||||||
local version=${1:-HEAD} format=${3:-"--text"}
|
local version=${1:-HEAD} format=${3:-"--text"}
|
||||||
|
|
||||||
if ! command git -C "$ZSH" show-ref --verify refs/heads/$version &>/dev/null && \
|
if (
|
||||||
! command git -C "$ZSH" show-ref --verify refs/tags/$version &>/dev/null && \
|
cd "$ZSH"
|
||||||
! command git -C "$ZSH" rev-parse --verify "${version}^{commit}" &>/dev/null; then
|
! 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
|
cat >&2 <<EOF
|
||||||
Usage: omz changelog [version]
|
Usage: omz changelog [version]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue