diff --git a/.gitignore b/.gitignore index aaa9c45..9945507 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ pkgsets/ archive/ environments/ tmp/ +logs/ *.log scripts/gvm Gemfile.lock diff --git a/scripts/gvm-check b/scripts/gvm-check index 870cacf..5db7e5c 100755 --- a/scripts/gvm-check +++ b/scripts/gvm-check @@ -8,8 +8,8 @@ command -v git &> /dev/null || error_message="${error_message} Could not find git - linux: apt-get install mercurial - mac: brew install mercurial + linux: apt-get install git + mac: brew install git " # Check for ar command -v ar &> /dev/null || diff --git a/scripts/install b/scripts/install index a039c27..4cc5a6d 100755 --- a/scripts/install +++ b/scripts/install @@ -73,9 +73,14 @@ update_source() { display_fatal "Couldn't get latest Go version info. Check the logs $GVM_ROOT/logs/go-download.log") } -copy_source() { - git clone -b "$version" "$GO_CACHE_PATH" "$GO_INSTALL_ROOT" >> "$GVM_ROOT/logs/go-$GO_NAME-install.log" 2>&1 || - display_fatal "Couldn't copy source to target folder. Check the logs $GVM_ROOT/logs/go-$GO_NAME-install.log" +create_worktree() { + # $GO_CACHE_PATH – shared repository (created by download_source) + # $GO_INSTALL_ROOT – target directory under $GVM_ROOT/gos/ + # $version – exact tag matching the requested version + # Create the worktree and log any problem. + git -C "$GO_CACHE_PATH" worktree add "$GO_INSTALL_ROOT" "$version" \ + >> "$GVM_ROOT/logs/go-${GO_NAME}-worktree.log" 2>&1 \ + || display_fatal "Failed to create worktree for $version. See $GVM_ROOT/logs/go-${GO_NAME}-worktree.log" } @@ -153,7 +158,7 @@ install_go() { fi create_global_package_set - copy_source + create_worktree compile_go create_enviroment