baseline: use mainline remote-tracking ref instead of HEAD#317
Conversation
The mainline fallback candidate was LocalRef("HEAD"), which
resolves to whatever the local repo has checked out. Nothing
in Sashiko advances the local HEAD after fetching:
GitSyncWorker updates remote-tracking refs (origin/master)
but never the local checkout. So HEAD drifts behind
origin/master indefinitely.
This caused a real failure: a patch series with an unreachable
base-commit fell through to the HEAD fallback, which resolved
to a stale commit where the patches could not apply, even
though origin/master (v7.2-rc2) was a valid baseline.
Store the identified mainline remote (Linus tree URL or
origin) in BaselineRegistry and emit it as a RemoteTarget
instead of LocalRef("HEAD"). This has two effects:
- ensure_remote is called before use, fetching the remote
if the last fetch is older than the configured interval.
- The ref resolves to the remote-tracking ref (e.g.
origin/master), which tracks the fetched state rather
than the local checkout.
When no mainline remote can be identified (no
torvalds/linux.git and no origin), fall back to
LocalRef("HEAD") as before.
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
|
That's not a local object FWIW, that's Linus' tag for v7.2-rc2 so it's possible local reproduction might find the tag happily if you've pulled tags - probably it's worth Sashiko pulling tags from at least Linus' tree since this behaviour is coming from b4. Possibly also -next since people often use it as a base for cross-subsystem serieses. |
Thanks for the correction. The base-commit is indeed the annotated tag object for v7.2-rc2, not a local-only SHA. Sashiko was fetching with --no-tags everywhere, so tag objects were never available locally, and the direct git fetch origin recovery also fails because git servers don't expose tag objects for fetch by SHA. I've added a second commit that fetches tags from origin when the direct SHA fetch fails to resolve. This only fires in the already-failing recovery path. |
0c2662a to
cad218d
Compare
|
Mark resent it, unfortunately, HEAD wasn't advanced (same bug the first commit this PR fixes), so it didn't apply: https://sashiko.dev/#/patchset/20260709-kvm-arm64-sme-v12-0-d0301d79ef58%40kernel.org |
b4 can emit annotated tag object SHAs as the base-commit header (e.g. the tag object for v7.2-rc2 rather than the commit it points to). Since ensure_remote fetches with --no-tags, these objects are never available locally, and the direct "git fetch origin <sha>" recovery also fails because git servers do not expose tag objects for fetch by SHA. Add a second recovery step: when the direct SHA fetch does not resolve the ref, fetch tags from the mainline remote and retry. The mainline remote (Linus tree or origin) is the one BaselineRegistry already identifies, so this does not assume the remote is named origin. This only fires in the already-failing path, so there is no extra cost on the happy path. Assisted-by: Antigravity:gemini-3.1-pro Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
The direct base-commit recovery fetched from a hardcoded "origin", but the mainline remote is not always named origin: it may be Linus's tree under a different name, as identified by BaselineRegistry. When it is not origin, the fetch targets the wrong remote and silently fails. Use the identified mainline remote, matching the tag-fetch recovery. Assisted-by: Antigravity:gemini-3.1-pro Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
cad218d to
5f7a3a1
Compare
The mainline fallback candidate in baseline resolution was
LocalRef("HEAD"), which resolves to whatever the local repo has checked out. Nothing in Sashiko advances the localHEADafter fetching:GitSyncWorkerupdates remote-tracking refs (origin/master) but never the local checkout. SoHEADdrifts behindorigin/masterindefinitely.Additionally,
ensure_remotefetches with--no-tags, so annotated tag objects are never available locally. b4 can emit annotated tag object SHAs as thebase-commitheader (the tag object rather than the commit it points to), and these are not fetchable by SHA either.Trigger: Mark Brown's KVM/arm64 SME v11 series included
base-commit: 4c45e14df2f4e77982ad70d6d8e3fe750edd4c37, which is the annotated tag object forv7.2-rc2. Sashiko could not resolve it for two reasons: the tag object was never fetched (--no-tags), and the fallback toHEADresolved to a stale commit well behindorigin/master. The series applies cleanly to v7.2-rc2, but Sashiko failed to apply it and did not produce a review.Fixes:
Use mainline remote-tracking ref instead of HEAD. Store the identified mainline remote (Linus tree or
origin) inBaselineRegistryand emit it as aRemoteTargetinstead ofLocalRef("HEAD"). This causesensure_remoteto fetch the remote if stale, and resolves the ref to the remote-tracking branch (e.g.origin/master) rather than the local checkout. Falls back toLocalRef("HEAD")when no mainline remote can be identified.Fetch tags when base-commit SHA is unresolvable. When the direct
git fetch <sha>recovery fails to resolve aCommitbaseline, fetch tags from the mainline remote (git fetch <remote> --tags) and retry. This handles the b4 case wherebase-commitis a tag object SHA. Tags are fetched from the mainline remote thatBaselineRegistryalready identifies, so it does not assume the remote is namedorigin, and it keeps the tag namespace clean rather than pulling every subsystem tree's tags. Only fires in the already-failing recovery path.Fetch the missing base commit from the mainline remote. The pre-existing direct base-commit recovery fetched from a hardcoded
origin. The mainline remote is not always namedorigin(it may be Linus's tree under a different name), in which case the fetch targeted the wrong remote and silently failed. Use the identified mainline remote, matching the tag-fetch recovery.