From d03a678e6e0a46a18943709bb483cc54afb60a0f Mon Sep 17 00:00:00 2001 From: Jeremy McClure Date: Sat, 1 Aug 2026 20:15:43 -0400 Subject: [PATCH] fix: ensure reset works with local modifications --- bootstrap.sh | 2 +- default/.config/zsh/functions.zsh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 476b5f9..392b6c0 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -182,7 +182,7 @@ update_repo() { local old_sha old_sha=$(git rev-parse HEAD) git fetch origin &>/dev/null && git reset --hard origin/master &>/dev/null && git clean -fd &>/dev/null - git log --format='%C(yellow)%h%C(reset) %C(cyan)%ar%C(reset) %s' "$old_sha"..HEAD + git log --format='%C(yellow)%h%C(reset) %C(cyan)%ar%C(reset) %s' -10 else info "Repository not found. Cloning..." git clone --depth=1 "$REPO_URL" "$TARGET_DIR" &>/dev/null diff --git a/default/.config/zsh/functions.zsh b/default/.config/zsh/functions.zsh index 6b25c24..580fe86 100644 --- a/default/.config/zsh/functions.zsh +++ b/default/.config/zsh/functions.zsh @@ -28,17 +28,17 @@ dotstate-update() { remote_sha=$(timeout 5 git ls-remote "$REPO_URL" HEAD | awk '{print $1}') [[ -z "$remote_sha" ]] && { cd ~; return 0; } local_sha=$(git rev-parse HEAD) - if [[ "$remote_sha" == "$local_sha" ]]; then + local has_changes=false + [[ -n "$(git status --porcelain)" ]] && has_changes=true + if [[ "$remote_sha" == "$local_sha" && "$has_changes" == "false" ]]; then cd ~ return 0 fi warn "Dotfiles out of date. Updating..." printf "\033[1;34m────────────────────────────────────────────────────\033[0m\n" - local old_sha - old_sha=$(git rev-parse HEAD) git fetch origin &>/dev/null && git reset --hard origin/master &>/dev/null && git clean -fd &>/dev/null - git log -5 --format='%C(yellow)%h%C(reset) %C(cyan)%ar%C(reset) %s' "$old_sha"..HEAD + git log -5 --format='%C(yellow)%h%C(reset) %C(cyan)%ar%C(reset) %s' printf "\033[1;34m────────────────────────────────────────────────────\033[0m\n" cd ~ dotstate doctor --fix &>/dev/null