Skip to content

fix(rebase): apply committed patch series directly onto upstream#18

Merged
sunrunnerfire merged 1 commit into
mainfrom
fix/rebase-upstream-apply-committed-patches
Jun 3, 2026
Merged

fix(rebase): apply committed patch series directly onto upstream#18
sunrunnerfire merged 1 commit into
mainfrom
fix/rebase-upstream-apply-committed-patches

Conversation

@sunrunnerfire

Copy link
Copy Markdown
Contributor

What

Validation of the generalized rebase-upstream.sh (run 26856151358) exposed a pre-existing bug that the generalization inherited: the script built its replay series by snapshotting the working tree, assuming apply-patches.sh had run first. In CI the submodules sit at their pinned SHAs with no patches applied, so the snapshot was empty (from X..X) — the script reset to upstream and git am-ed an empty set, yielding a spurious conflict every run. The original PR #14 'conflict' was this bug, not real upstream drift.

Fix

  • Apply patches/<submodule>/*.patch directly onto the freshly-reset upstream via git am -3. The committed patch files are the source of truth — no working-tree dependency, no apply-patches.sh prerequisite.
  • Preserve curated patch filenames on regeneration (positional; series order is stable). Without this, git format-patch renames files from the commit subject (e.g. 0001-metal-correctness-...0001-metal-gate-has_simdgroup_...), churning the series and breaking the doc references / 0001-0002 numbering every rebase.

Validation (local, isolated from upstream drift)

Replayed onto the pinned base (where the patch must apply cleanly) for whisper.cpp:

==> [whisper.cpp] resetting to 338cce1e...
==> [whisper.cpp] applying patches/whisper.cpp/*.patch with three-way merge
    updated: 0001-metal-correctness-on-non-apple-silicon.patch

Clean git am, filename preserved, regenerated content byte-identical to the committed patch (only git's index-hash abbreviation length differs). bash -n clean.

After merge I'll re-run the workflow end-to-end — conflicts there will now be real upstream drift (meaningful), no longer spurious.

The rebase script (both before and after the 4-submodule generalization)
snapshotted the *working tree* to build the replay series, assuming
apply-patches.sh had run first. In CI the submodules are checked out at their
pinned SHAs with no patches applied, so the snapshot was empty: the script
reset to upstream and then 'git am'-ed an empty series, producing a spurious
conflict on every run. The original PR #14 'conflict' was this bug, not real
upstream drift.

Apply patches/<submodule>/*.patch directly onto the freshly-reset upstream via
git am -3 — the committed patch files are the source of truth, no working-tree
dependency. Preserve the curated patch filenames on regeneration (positional,
since series order is stable) so doc references and the 0001/0002 numbering
don't churn. Validated locally: clean apply onto the pinned base, filename
preserved, content identical.
@sunrunnerfire sunrunnerfire merged commit f571bba into main Jun 3, 2026
6 checks passed
@sunrunnerfire sunrunnerfire deleted the fix/rebase-upstream-apply-committed-patches branch June 3, 2026 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant