mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 10:15:53 +08:00 
			
		
		
		
	[New] Speedup process to install nvm from git by dropping commit history
This commit is contained in:
		
				
					committed by
					
						 Jordan Harband
						Jordan Harband
					
				
			
			
				
	
			
			
			
						parent
						
							3ac49e5ef1
						
					
				
				
					commit
					1e69c4c77d
				
			| @@ -84,7 +84,7 @@ install_nvm_from_git() { | ||||
|   if [ -d "$INSTALL_DIR/.git" ]; then | ||||
|     echo "=> nvm is already installed in $INSTALL_DIR, trying to update using git" | ||||
|     command 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 origin tag "$(nvm_latest_version)" --depth=1 2> /dev/null || { | ||||
|       echo >&2 "Failed to update nvm, run 'git fetch' in $INSTALL_DIR yourself." | ||||
|       exit 1 | ||||
|     } | ||||
| @@ -103,12 +103,12 @@ install_nvm_from_git() { | ||||
|         echo >&2 'Failed to add remote "origin" (or set the URL). Please report this!' | ||||
|         exit 2 | ||||
|       } | ||||
|       command git --git-dir="${INSTALL_DIR}/.git" fetch origin --tags || { | ||||
|       command git --git-dir="${INSTALL_DIR}/.git" fetch origin tag "$(nvm_latest_version)" --depth=1 || { | ||||
|         echo >&2 'Failed to fetch origin with tags. Please report this!' | ||||
|         exit 2 | ||||
|       } | ||||
|     else | ||||
|       command git clone "$(nvm_source)" "${INSTALL_DIR}" || { | ||||
|       command git clone "$(nvm_source)" -b "$(nvm_latest_version)" --depth=1 "${INSTALL_DIR}" || { | ||||
|         echo >&2 'Failed to clone nvm repo. Please report this!' | ||||
|         exit 2 | ||||
|       } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user