fix(git-workflow): fetch all origins before status snapshot in sync + finish

repo-status.sh derives up_to_date_with_main from the local origin/<main>
ref without fetching, so a stale snapshot could mark a repo "up to date"
when its origin had actually moved. sync would then report "all up to
date" and skip a needed rebase; finish would pass pre-flight and only
discover the staleness mid-merge.

Both skills now run `for-each-repo.sh fetch origin` as a mandatory first
step before the snapshot. Dropped the redundant per-repo fetch from sync's
execute step; kept finish's `pull --ff-only` as defense-in-depth.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Gergő Törcsvári 2026-05-29 16:13:08 +02:00
commit 1c6745f0d0
No known key found for this signature in database
GPG key ID: 8E75F2CDE64E5322
2 changed files with 14 additions and 12 deletions

View file

@ -11,11 +11,12 @@ Per-repo main mapping is in `scripts/git-workflow/repos.sh` (root=`main`, subs=`
## Pre-flight (all of these must pass before any merge happens)
1. Run `bash /Users/torcsi/dev/kicad-wasm/scripts/git-workflow/repo-status.sh`. Parse the JSON.
2. All 3 repos must have `dirty: false`. If any is dirty, STOP and tell the user to commit (`/git-feature-commit`) or stash first.
3. All 3 repos must be on the same feature branch (use root's branch as the reference). If not, STOP and report the mismatch.
4. All 3 repos must have `up_to_date_with_main: true` (i.e. the feature is rebased onto the latest main). If any isn't, STOP and instruct: "run `/git-feature-sync` first".
5. None may have `rebase_in_progress: true`. If so, STOP.
1. **Fetch every origin FIRST.** Run `bash /Users/torcsi/dev/kicad-wasm/scripts/git-workflow/for-each-repo.sh fetch origin`. This is mandatory and must happen *before* the status snapshot. `repo-status.sh` derives `up_to_date_with_main` from the local `origin/<main>` ref **without fetching** — so without this step a repo whose origin has moved looks "up to date", check 5 passes, and the staleness is only discovered mid-merge (the `pull --ff-only` in the steps below would catch it, but then you've already merged the earlier repos). Fetching here makes the pre-flight STOP cleanly with "run `/git-feature-sync` first" instead of bailing partway through.
2. Run `bash /Users/torcsi/dev/kicad-wasm/scripts/git-workflow/repo-status.sh`. Parse the JSON. Because step 1 just fetched, `up_to_date_with_main` now reflects true remote state.
3. All 3 repos must have `dirty: false`. If any is dirty, STOP and tell the user to commit (`/git-feature-commit`) or stash first.
4. All 3 repos must be on the same feature branch (use root's branch as the reference). If not, STOP and report the mismatch.
5. All 3 repos must have `up_to_date_with_main: true` (i.e. the feature is rebased onto the latest main). If any isn't, STOP and instruct: "run `/git-feature-sync` first".
6. None may have `rebase_in_progress: true`. If so, STOP.
## Steps — order: kicad, wxwidgets, root