From 83f95e1f3f6354ffa9cc9ce05c7dfaeef133b07c Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Mon, 11 May 2026 20:01:09 -0400 Subject: [PATCH] fix install_nvchad.sh: stash around pull, use deploy_nvim from _lib.sh The bare git pull was blocking sync when nvchad had local changes (e.g. a typechange from symlink), causing set -euo pipefail to abort the whole script before deploy_nvim ran. Stash/pop makes the pull safe. Replaces the local deploy_nvim_modules (which blindly backed up and recreated symlinks every run, accumulating .backup files) with deploy_nvim from _lib.sh, which is idempotent and shared with sync.sh. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- install_nvchad.sh | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/install_nvchad.sh b/install_nvchad.sh index 7c80d5d..8ab096c 100755 --- a/install_nvchad.sh +++ b/install_nvchad.sh @@ -5,20 +5,7 @@ REPO="git@gitea.hptrow.me:pt/nvchad.git" BRANCH="customize" NVIM_CONFIG="$HOME/.config/nvim" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" - -deploy_nvim_modules() { - local src_dir="$SCRIPT_DIR/dotfiles/nvim" - [[ -d "$src_dir" ]] || return 0 - [[ -d "$NVIM_CONFIG/lua" ]] || return 0 - echo "Deploying nvim lua modules..." - for mod in "$src_dir"/*.lua; do - [[ -f "$mod" ]] || continue - local target="$NVIM_CONFIG/lua/$(basename "$mod")" - [[ -e "$target" ]] && mv "$target" "${target}.backup" - ln -s "$mod" "$target" - echo " linked: $(basename "$mod")" - done -} +source "$SCRIPT_DIR/_lib.sh" echo "============================================" echo "NvChad Configuration Installation Script" @@ -59,8 +46,10 @@ if [ -d "$NVIM_CONFIG/.git" ]; then EXISTING_REMOTE=$(git -C "$NVIM_CONFIG" remote get-url "$REMOTE_NAME" 2>/dev/null || echo "") if [ "$EXISTING_REMOTE" = "$REPO" ]; then echo "NvChad config already installed — pulling latest..." + git -C "$NVIM_CONFIG" stash git -C "$NVIM_CONFIG" pull "$REMOTE_NAME" "$BRANCH" - deploy_nvim_modules + git -C "$NVIM_CONFIG" stash pop 2>/dev/null || true + deploy_nvim echo "Done." exit 0 fi @@ -105,7 +94,7 @@ echo "" echo "Config cloned successfully!" echo "" -deploy_nvim_modules +deploy_nvim echo "" echo "============================================"