From 2c0282778e7c9140c7f03508371ef7b508c6e4a2 Mon Sep 17 00:00:00 2001 From: Fabian Ising Date: Sun, 5 Jul 2026 17:27:56 +0200 Subject: [PATCH] [ZSH] Config update robusteness fix --- zsh/.zshrc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index ecdf7cd..5ab9ca0 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -6,14 +6,20 @@ [[ -f ~/.zsh/.virtual_env_config.zsh ]] && source ~/.zsh/.virtual_env_config.zsh [[ -f ~/.zsh/.local_config ]] && source ~/.zsh/.local_config +# On shell start, bring ~/dotfiles up to date by fast-forwarding the CURRENT +# branch to its upstream only. Never rebase or stash in the background: if the +# branch diverged or local edits block it, warn and leave it for a manual pull. +# Per-branch, so `server` on each device fast-forwards to origin/server. update_dotfiles() { - cd ~/dotfiles || return - if git fetch --dry-run 2>&1 | grep -q .; then - git pull > /dev/null 2>&1 - fi + local repo="$HOME/dotfiles" + git -C "$repo" fetch --quiet 2>/dev/null || return + git -C "$repo" rev-parse --abbrev-ref '@{u}' >/dev/null 2>&1 || return # no upstream + git -C "$repo" merge-base --is-ancestor '@{u}' HEAD 2>/dev/null && return # already current + git -C "$repo" merge --ff-only --quiet '@{u}' 2>/dev/null \ + || print -u2 "⚠ dotfiles: $(git -C "$repo" symbolic-ref --short HEAD) can't fast-forward to @{u} — run: git -C ~/dotfiles pull" } -update_dotfiles 2>&1 &! +update_dotfiles &! export LC_OSC52=1 # Load Antidote