From 4a35d31483151ff20d0b5faca3bcb25ca2c5890b Mon Sep 17 00:00:00 2001 From: Jeremy McClure Date: Sat, 1 Aug 2026 16:41:46 -0400 Subject: [PATCH] fix: cd to target dir before git commands to avoid CWD permission issues --- default/.config/zsh/functions.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/default/.config/zsh/functions.zsh b/default/.config/zsh/functions.zsh index 36ecfea..6c1fcfb 100644 --- a/default/.config/zsh/functions.zsh +++ b/default/.config/zsh/functions.zsh @@ -18,14 +18,16 @@ dotstate_update() { [[ "$(id -u)" -ne "$(stat -c '%u' "$TARGET_DIR" 2>/dev/null)" ]] && return 0 [[ ! -d "$TARGET_DIR/.git" ]] && return 0 + cd "$TARGET_DIR" || return 0 + local remote_sha local_sha remote_sha=$(timeout 5 git ls-remote "$REPO_URL" HEAD | awk '{print $1}') [[ -z "$remote_sha" ]] && return 0 - local_sha=$(git -C "$TARGET_DIR" rev-parse HEAD) + local_sha=$(git rev-parse HEAD) [[ "$remote_sha" == "$local_sha" ]] && return 0 info "Repository out of date. Pulling updates..." - git -C "$TARGET_DIR" pull &>/dev/null + git pull &>/dev/null dotstate activate exec zsh } \ No newline at end of file