mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-12 20:21:02 +01:00
fix: do not call chpwd hooks in subshells
This commit is contained in:
parent
4e0f19cf92
commit
84931adcd4
2 changed files with 10 additions and 10 deletions
10
lib/cli.zsh
10
lib/cli.zsh
|
@ -37,7 +37,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)$(cd "$ZSH"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
|
refs=("${(@f)$(builtin cd -q "$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)'
|
||||||
|
@ -176,7 +176,7 @@ function _omz::changelog {
|
||||||
local version=${1:-HEAD} format=${3:-"--text"}
|
local version=${1:-HEAD} format=${3:-"--text"}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
cd "$ZSH"
|
builtin cd -q "$ZSH"
|
||||||
! command git show-ref --verify refs/heads/$version && \
|
! command git show-ref --verify refs/heads/$version && \
|
||||||
! command git show-ref --verify refs/tags/$version && \
|
! command git show-ref --verify refs/tags/$version && \
|
||||||
! command git rev-parse --verify "${version}^{commit}"
|
! command git rev-parse --verify "${version}^{commit}"
|
||||||
|
@ -761,7 +761,7 @@ function _omz::theme::use {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _omz::update {
|
function _omz::update {
|
||||||
local last_commit=$(cd "$ZSH"; git rev-parse HEAD)
|
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD)
|
||||||
|
|
||||||
# Run update script
|
# Run update script
|
||||||
if [[ "$1" != --unattended ]]; then
|
if [[ "$1" != --unattended ]]; then
|
||||||
|
@ -777,7 +777,7 @@ function _omz::update {
|
||||||
command rm -rf "$ZSH/log/update.lock"
|
command rm -rf "$ZSH/log/update.lock"
|
||||||
|
|
||||||
# Restart the zsh session if there were changes
|
# Restart the zsh session if there were changes
|
||||||
if [[ "$1" != --unattended && "$(cd "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then
|
if [[ "$1" != --unattended && "$(builtin cd -q "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then
|
||||||
# Old zsh versions don't have ZSH_ARGZERO
|
# Old zsh versions don't have ZSH_ARGZERO
|
||||||
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
||||||
# Check whether to run a login shell
|
# Check whether to run a login shell
|
||||||
|
@ -787,7 +787,7 @@ function _omz::update {
|
||||||
|
|
||||||
function _omz::version {
|
function _omz::version {
|
||||||
(
|
(
|
||||||
cd "$ZSH"
|
builtin cd -q "$ZSH"
|
||||||
|
|
||||||
# Get the version name:
|
# Get the version name:
|
||||||
# 1) try tag-like version
|
# 1) try tag-like version
|
||||||
|
|
|
@ -36,11 +36,11 @@ function current_epoch() {
|
||||||
|
|
||||||
function is_update_available() {
|
function is_update_available() {
|
||||||
local branch
|
local branch
|
||||||
branch=${"$(cd "$ZSH"; git config --local oh-my-zsh.branch)":-master}
|
branch=${"$(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 "$ZSH"; git config --local oh-my-zsh.remote)":-origin}
|
remote=${"$(cd -q "$ZSH"; git config --local oh-my-zsh.remote)":-origin}
|
||||||
remote_url=$(cd "$ZSH"; git config remote.$remote.url)
|
remote_url=$(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 "$ZSH"; git rev-parse $branch 2>/dev/null) || return 0
|
local_head=$(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)
|
||||||
|
@ -136,7 +136,7 @@ function update_ohmyzsh() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Test if Oh My Zsh directory is a git repository
|
# Test if Oh My Zsh directory is a git repository
|
||||||
if ! (cd "$ZSH" && LANG= git rev-parse &>/dev/null); then
|
if ! (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