mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-18 10:22:00 +00:00
fix(updater): prefix cd
with builtin
when it is aliased (#10753)
This commit is contained in:
parent
46195d3aa7
commit
af0c3b64b8
1 changed files with 6 additions and 6 deletions
|
@ -36,11 +36,11 @@ function current_epoch() {
|
||||||
|
|
||||||
function is_update_available() {
|
function is_update_available() {
|
||||||
local branch
|
local branch
|
||||||
branch=${"$(cd -q "$ZSH"; git config --local oh-my-zsh.branch)":-master}
|
branch=${"$(builtin cd -q "$ZSH"; git config --local oh-my-zsh.branch)":-master}
|
||||||
|
|
||||||
local remote remote_url remote_repo
|
local remote remote_url remote_repo
|
||||||
remote=${"$(cd -q "$ZSH"; git config --local oh-my-zsh.remote)":-origin}
|
remote=${"$(builtin cd -q "$ZSH"; git config --local oh-my-zsh.remote)":-origin}
|
||||||
remote_url=$(cd -q "$ZSH"; git config remote.$remote.url)
|
remote_url=$(builtin cd -q "$ZSH"; git config remote.$remote.url)
|
||||||
|
|
||||||
local repo
|
local repo
|
||||||
case "$remote_url" in
|
case "$remote_url" in
|
||||||
|
@ -58,7 +58,7 @@ function is_update_available() {
|
||||||
|
|
||||||
# Get local HEAD. If this fails assume there are updates
|
# Get local HEAD. If this fails assume there are updates
|
||||||
local local_head
|
local local_head
|
||||||
local_head=$(cd -q "$ZSH"; git rev-parse $branch 2>/dev/null) || return 0
|
local_head=$(builtin cd -q "$ZSH"; git rev-parse $branch 2>/dev/null) || return 0
|
||||||
|
|
||||||
# Get remote HEAD. If no suitable command is found assume there are updates
|
# Get remote HEAD. If no suitable command is found assume there are updates
|
||||||
# On any other error, skip the update (connection may be down)
|
# On any other error, skip the update (connection may be down)
|
||||||
|
@ -81,7 +81,7 @@ function is_update_available() {
|
||||||
# If local and remote HEADs don't match, check if there's a common ancestor
|
# If local and remote HEADs don't match, check if there's a common ancestor
|
||||||
# If the merge-base call fails, $remote_head might not be downloaded so assume there are updates
|
# If the merge-base call fails, $remote_head might not be downloaded so assume there are updates
|
||||||
local base
|
local base
|
||||||
base=$(cd -q "$ZSH"; git merge-base $local_head $remote_head 2>/dev/null) || return 0
|
base=$(builtin cd -q "$ZSH"; git merge-base $local_head $remote_head 2>/dev/null) || return 0
|
||||||
|
|
||||||
# If the common ancestor ($base) is not $remote_head,
|
# If the common ancestor ($base) is not $remote_head,
|
||||||
# the local HEAD is older than the remote HEAD
|
# the local HEAD is older than the remote HEAD
|
||||||
|
@ -170,7 +170,7 @@ function has_typed_input() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Test if Oh My Zsh directory is a git repository
|
# Test if Oh My Zsh directory is a git repository
|
||||||
if ! (cd -q "$ZSH" && LANG= git rev-parse &>/dev/null); then
|
if ! (builtin cd -q "$ZSH" && LANG= git rev-parse &>/dev/null); then
|
||||||
echo >&2 "[oh-my-zsh] Can't update: not a git repository."
|
echo >&2 "[oh-my-zsh] Can't update: not a git repository."
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue