Skip to content

Commit eb26985

Browse files
(fix) remove unnecessary git dependency and fix empty array expansion in install script (#9)
Remove check_git/install_git functions and their invocation — git is not required by the install flow. Fix unbound variable error when prefix_args is empty under set -u by using ${arr[@]+"${arr[@]}"} pattern. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8eff9a4 commit eb26985

1 file changed

Lines changed: 1 addition & 56 deletions

File tree

public/install.sh

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -489,56 +489,6 @@ install_node() {
489489
fi
490490
}
491491

492-
# --- Git ---
493-
494-
check_git() {
495-
if command -v git &> /dev/null; then
496-
ui_success "Git already installed"
497-
return 0
498-
fi
499-
ui_info "Git not found, installing it now"
500-
return 1
501-
}
502-
503-
install_git() {
504-
if [[ "$OS" == "macos" ]]; then
505-
run_quiet_step "Installing Git" brew install git
506-
elif [[ "$OS" == "linux" ]]; then
507-
require_sudo
508-
if command -v apt-get &> /dev/null; then
509-
if is_root; then
510-
run_quiet_step "Updating package index" apt-get update -qq
511-
run_quiet_step "Installing Git" apt-get install -y -qq git
512-
else
513-
run_quiet_step "Updating package index" sudo apt-get update -qq
514-
run_quiet_step "Installing Git" sudo apt-get install -y -qq git
515-
fi
516-
elif command -v pacman &> /dev/null || is_arch_linux; then
517-
if is_root; then
518-
run_quiet_step "Installing Git" pacman -Sy --noconfirm git
519-
else
520-
run_quiet_step "Installing Git" sudo pacman -Sy --noconfirm git
521-
fi
522-
elif command -v dnf &> /dev/null; then
523-
if is_root; then
524-
run_quiet_step "Installing Git" dnf install -y -q git
525-
else
526-
run_quiet_step "Installing Git" sudo dnf install -y -q git
527-
fi
528-
elif command -v yum &> /dev/null; then
529-
if is_root; then
530-
run_quiet_step "Installing Git" yum install -y -q git
531-
else
532-
run_quiet_step "Installing Git" sudo yum install -y -q git
533-
fi
534-
else
535-
ui_error "Could not detect package manager for Git"
536-
exit 1
537-
fi
538-
fi
539-
ui_success "Git installed"
540-
}
541-
542492
# --- npm permissions (Linux) ---
543493

544494
fix_npm_permissions() {
@@ -643,7 +593,7 @@ run_npm_global_install() {
643593
fi
644594

645595
local -a cmd
646-
cmd=(npm --loglevel "$NPM_LOGLEVEL" --no-fund --no-audit install -g "${prefix_args[@]}" "$spec")
596+
cmd=(npm --loglevel "$NPM_LOGLEVEL" --no-fund --no-audit install -g ${prefix_args[@]+"${prefix_args[@]}"} "$spec")
647597
local cmd_display=""
648598
printf -v cmd_display '%q ' "${cmd[@]}"
649599
LAST_NPM_INSTALL_CMD="${cmd_display% }"
@@ -943,11 +893,6 @@ main() {
943893
if [[ "$LOCAL_INSTALL" == "1" ]]; then
944894
setup_local_path
945895
else
946-
# Git (required for npm installs that may apply patches)
947-
if ! check_git; then
948-
install_git
949-
fi
950-
951896
# npm permissions (Linux)
952897
fix_npm_permissions
953898
fi

0 commit comments

Comments
 (0)