Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update install.sh #1213

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,20 @@ install_nvm_from_git() {
exit 1
}
else
echo "=> Cleanup old nvm dir '$INSTALL_DIR'"
command rm -rf "$INSTALL_DIR/nvm-exec" "$INSTALL_DIR/nvm.sh"
# Cloning to $INSTALL_DIR
echo "=> Downloading nvm from git to '$INSTALL_DIR'"
command printf "\r=> "
mkdir -p "$INSTALL_DIR"
command git clone "$(nvm_source)" "$INSTALL_DIR" || {
command git init "$INSTALL_DIR"
command git --git-dir="$INSTALL_DIR"/.git remote add origin "$(nvm_source)"
command git --git-dir="$INSTALL_DIR"/.git fetch origin --tags
command git --git-dir="$INSTALL_DIR"/.git pull origin master || {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the fetch succeeds, why do we need to pull? Can't we just check out the tag directly? We shouldn't even need a local master branch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just prevent the error message "fatal: branch 'master' does not exist", and it won't hurt actually, even may make the next upgrade faster, what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where would that error come from? Nothing in nvm works with the master branch that I'm aware of.

echo >&2 "Failed to clone nvm repo. Please report this!"
exit 1
}
command git --git-dir="$INSTALL_DIR"/.git branch --set-upstream-to=origin/master master
fi
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
Expand Down