[Fix] install should not exit after successful git clone

Fixes #1146 by grouping the commands that handle the error.

I also removed a subshell wrapper from a similar set of lines right
above. It looks to me like that is no longer necessary.
Owen Smith 2016-07-05 19:22:52 -07:00
parent f3ce324e22
commit 8c8bf1204c
1 changed files with 8 additions and 5 deletions

View File

@ -69,16 +69,19 @@ install_nvm_from_git() {
if [ -d "$INSTALL_DIR/.git" ]; then if [ -d "$INSTALL_DIR/.git" ]; then
echo "=> nvm is already installed in $INSTALL_DIR, trying to update using git" echo "=> nvm is already installed in $INSTALL_DIR, trying to update using git"
printf "\r=> " printf "\r=> "
(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" fetch 2> /dev/null || { command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" fetch 2> /dev/null || {
echo >&2 "Failed to update nvm, run 'git fetch' in $INSTALL_DIR yourself." && exit 1 echo >&2 "Failed to update nvm, run 'git fetch' in $INSTALL_DIR yourself."
}) exit 1
}
else else
# Cloning to $NVM_DIR # Cloning to $NVM_DIR
echo "=> Downloading nvm from git to '$INSTALL_DIR'" echo "=> Downloading nvm from git to '$INSTALL_DIR'"
printf "\r=> " printf "\r=> "
mkdir -p "$INSTALL_DIR" mkdir -p "$INSTALL_DIR"
command git clone "$(nvm_source)" "$INSTALL_DIR" \ command git clone "$(nvm_source)" "$INSTALL_DIR" || {
|| echo >&2 "Failed to clone nvm repo. Please report this!" && exit 1 echo >&2 "Failed to clone nvm repo. Please report this!"
exit 1
}
fi fi
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" checkout --quiet "$(nvm_latest_version)" command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" checkout --quiet "$(nvm_latest_version)"
if [ ! -z "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then if [ ! -z "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then