Compare commits

...

3 Commits

Author SHA1 Message Date
Roy Ivy III
0803bbc94e
Merge cae2eb71a2d7edd13a16b86d1bc0f749b25fd290 into ff1257e8e3059ae01928c4261a41de2260bcd968 2024-07-28 20:59:30 -05:00
Jordan Harband
ff1257e8e3
[Refactor] nvm_has_colors: also check the env var 2024-07-28 18:01:14 -07:00
Roy Ivy III
cae2eb71a2 [Fix] specify 'origin' remote name with git clone ... installs
`git` may be configured locally to use a non-'origin' default remote name.
So, specify 'origin' as the remote name when cloning to get the expected setup.
2024-05-03 00:36:04 -05:00
2 changed files with 5 additions and 4 deletions

View File

@ -163,7 +163,8 @@ install_nvm_from_git() {
}
else
# Cloning repo
command git clone "$(nvm_source)" --depth=1 "${INSTALL_DIR}" || {
command git clone "$(nvm_source)" --depth=1 -o origin "${INSTALL_DIR}" 2> /dev/null \
|| command git clone "$(nvm_source)" --depth=1 "${INSTALL_DIR}" || {
nvm_echo >&2 'Failed to clone nvm repo. Please report this!'
exit 2
}

6
nvm.sh
View File

@ -83,7 +83,7 @@ nvm_has_colors() {
if nvm_has tput; then
NVM_NUM_COLORS="$(tput -T "${TERM:-vt100}" colors)"
fi
[ "${NVM_NUM_COLORS:--1}" -ge 8 ]
[ "${NVM_NUM_COLORS:--1}" -ge 8 ] && [ "${NVM_NO_COLORS-}" != '--no-colors' ]
}
nvm_curl_libz_support() {
@ -1094,7 +1094,7 @@ nvm_print_formatted_alias() {
fi
local ARROW
ARROW='->'
if [ -z "${NVM_NO_COLORS}" ] && nvm_has_colors; then
if nvm_has_colors; then
ARROW='\033[0;90m->\033[0m'
if [ "_${DEFAULT}" = '_true' ]; then
NEWLINE=" \033[${DEFAULT_COLOR}(default)\033[0m\n"
@ -1832,7 +1832,7 @@ nvm_print_versions() {
DEFAULT_COLOR=$(nvm_get_colors 5)
LTS_COLOR=$(nvm_get_colors 6)
if [ -z "${NVM_NO_COLORS-}" ] && nvm_has_colors; then
if nvm_has_colors; then
NVM_HAS_COLORS=1
fi