Fix skills auto-update to fetch from tracking branch

Determine and fetch from the current branch's tracking remote instead of
hardcoding upstream/origin. This ensures the correct remote is updated
regardless of fork/upstream setup.

Fixes issue where auto-update wasn't fetching on session start.
This commit is contained in:
Jesse Vincent
2025-10-11 14:06:29 -07:00
parent 488139d6d1
commit 9eefffc541
2 changed files with 9 additions and 182 deletions

View File

@@ -8,8 +8,15 @@ SKILLS_REPO="https://github.com/obra/superpowers-skills.git"
if [ -d "$SKILLS_DIR/.git" ]; then
cd "$SKILLS_DIR"
# Fetch upstream (silently)
git fetch upstream 2>/dev/null || git fetch origin 2>/dev/null || true
# Get the remote name for the current tracking branch
TRACKING_REMOTE=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null | cut -d'/' -f1 || echo "")
# Fetch from tracking remote if set, otherwise try upstream then origin
if [ -n "$TRACKING_REMOTE" ]; then
git fetch "$TRACKING_REMOTE" 2>/dev/null || true
else
git fetch upstream 2>/dev/null || git fetch origin 2>/dev/null || true
fi
# Check if we can fast-forward
LOCAL=$(git rev-parse @ 2>/dev/null || echo "")