[Fix] install script: check the proper version; fetch tags also

Co-authored-by: Sladyn Nunes <sladynnunes98@gmail.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
Sladyn Nunes 2021-04-01 19:06:40 +05:30 committed by Jordan Harband
parent f534fde760
commit 2b5e53fcd5
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
1 changed files with 13 additions and 5 deletions

View File

@ -55,14 +55,18 @@ test_install_data() {
local ref="$4" local ref="$4"
local changeset="$5" local changeset="$5"
local avoid_ref="$6" local avoid_ref="$6"
if [ -n "$ref" ]; then if [ -n "$ref" ]; then
echo "$current_ref" | grep -q "$ref" || die "install_nvm_from_git $message did not clone with ref $ref" echo "$current_ref" | grep -q "$ref" || die "install_nvm_from_git ${message} did not clone with ref ${ref}"
fi fi
if [ -n "$avoid_ref" ]; then
echo "$current_ref" | grep -q "$avoid_ref" && die "install_nvm_from_git $message did clone with unwanted ref $avoid_ref" local head_ref="$(git for-each-ref --points-at HEAD --format='%(refname:short)' 'refs/tags/')"
if [ -n "${avoid_ref}" ] && [ "${head_ref}" != "${avoid_ref}"]; then
echo "${current_ref}" | grep -q "$avoid_ref" && die "install_nvm_from_git ${message} did clone with unwanted ref ${avoid_ref}"
fi fi
if [ -n "$changeset" ]; then if [ -n "$changeset" ]; then
echo "$current_changeset" | grep -q "$changeset" || die "install_nvm_from_git $message did not clone with changeset $changeset" echo "${current_changeset}" | grep -q "${changeset}" || die "install_nvm_from_git ${message} did not clone with changeset ${changeset}"
fi fi
} }
@ -73,7 +77,11 @@ test_install_data() {
# - 4: changeset to check ("" if none) # - 4: changeset to check ("" if none)
# - 5: ref to avoid ("" if none) # - 5: ref to avoid ("" if none)
test_install() { test_install() {
NVM_INSTALL_VERSION="$1" if [ -n "${1-}" ]; then
export NVM_INSTALL_VERSION="$1"
else
unset NVM_INSTALL_VERSION
fi
local message="$2" local message="$2"
local ref="$3" local ref="$3"
local changeset="$4" local changeset="$4"