[F] Fix update concurrency (#5)
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
if [[ -n "$ZSHRC_UPDATING" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
cd "$SCR" || return
|
cd "$SCR" || return
|
||||||
|
|
||||||
prefix="&7[&3zshrc&7]"
|
prefix="&7[&3zshrc&7]"
|
||||||
@@ -31,7 +35,7 @@ if git fetch origin --quiet && git rev-parse --verify --quiet "$remote_ref" >/de
|
|||||||
_zshrc_stash_if_needed
|
_zshrc_stash_if_needed
|
||||||
if git reset --hard "$remote_ref" && git submodule update --init --recursive --depth 1; then
|
if git reset --hard "$remote_ref" && git submodule update --init --recursive --depth 1; then
|
||||||
_zshrc_restore_stash
|
_zshrc_restore_stash
|
||||||
. "$SCR/zshrc.sh"
|
ZSHRC_UPDATING=1 . "$SCR/zshrc.sh"
|
||||||
color "$prefix &aUpdated after history rewrite!"
|
color "$prefix &aUpdated after history rewrite!"
|
||||||
else
|
else
|
||||||
color "$prefix &cUpdate failed!"
|
color "$prefix &cUpdate failed!"
|
||||||
@@ -47,7 +51,7 @@ if git fetch origin --quiet && git rev-parse --verify --quiet "$remote_ref" >/de
|
|||||||
_zshrc_stash_if_needed
|
_zshrc_stash_if_needed
|
||||||
if git merge --ff-only "$remote_ref" && git submodule update --init --recursive --depth 1; then
|
if git merge --ff-only "$remote_ref" && git submodule update --init --recursive --depth 1; then
|
||||||
_zshrc_restore_stash
|
_zshrc_restore_stash
|
||||||
. "$SCR/zshrc.sh"
|
ZSHRC_UPDATING=1 . "$SCR/zshrc.sh"
|
||||||
color "$prefix &aUpdated!"
|
color "$prefix &aUpdated!"
|
||||||
else
|
else
|
||||||
color "$prefix &cUpdate failed!"
|
color "$prefix &cUpdate failed!"
|
||||||
@@ -58,6 +62,6 @@ elif [[ -n "$ZSHRC_UPDATE_VERBOSE" ]]; then
|
|||||||
color "$prefix &cUpdate check failed!"
|
color "$prefix &cUpdate check failed!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset -f _zshrc_stash_if_needed _zshrc_restore_stash
|
unset -f _zshrc_stash_if_needed _zshrc_restore_stash 2>/dev/null
|
||||||
unset _zshrc_stash_created remote_ref reslog
|
unset _zshrc_stash_created remote_ref reslog
|
||||||
cd - &> /dev/null
|
cd - &> /dev/null
|
||||||
|
|||||||
Reference in New Issue
Block a user