diff options
| author | Jesse Vincent <jesse@fsck.com> | 2025-10-11 14:06:29 -0700 |
|---|---|---|
| committer | Jesse Vincent <jesse@fsck.com> | 2025-10-11 14:17:47 -0700 |
| commit | 9eefffc5417a8ee7096e646e573e82ebb64c41c3 (patch) | |
| tree | 666288513c7ad82c4afeec1785ae610bc845f850 /lib | |
| parent | 488139d6d1d5408ed0b428c990ccc5c343c4c82e (diff) | |
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.
Diffstat (limited to 'lib')
| -rwxr-xr-x | lib/initialize-skills.sh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/initialize-skills.sh b/lib/initialize-skills.sh index b3f99e2..3fb3fd8 100755 --- a/lib/initialize-skills.sh +++ b/lib/initialize-skills.sh @@ -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 "") |
