[ZSH] Config update robusteness fix

This commit is contained in:
Fabian Ising
2026-07-05 17:27:56 +02:00
parent 1a264a66f8
commit 2c0282778e
+11 -5
View File
@@ -6,14 +6,20 @@
[[ -f ~/.zsh/.virtual_env_config.zsh ]] && source ~/.zsh/.virtual_env_config.zsh [[ -f ~/.zsh/.virtual_env_config.zsh ]] && source ~/.zsh/.virtual_env_config.zsh
[[ -f ~/.zsh/.local_config ]] && source ~/.zsh/.local_config [[ -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() { update_dotfiles() {
cd ~/dotfiles || return local repo="$HOME/dotfiles"
if git fetch --dry-run 2>&1 | grep -q .; then git -C "$repo" fetch --quiet 2>/dev/null || return
git pull > /dev/null 2>&1 git -C "$repo" rev-parse --abbrev-ref '@{u}' >/dev/null 2>&1 || return # no upstream
fi 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 export LC_OSC52=1
# Load Antidote # Load Antidote