Signierskript richtet den Klon selbst aus - kein Handgriff mehr noetig
Der Waechter brach bisher ab und legte dem Menschen einen Befehl vor. Jetzt bringt er den Klon selbst auf origin/main, solange das nachweislich verlustfrei ist: reiner Rueckstand wird vorgespult; Commits, die nur lokal liegen, deren Tree aber dem des gemeinsamen Vorfahren gleicht, tragen inhaltlich nichts bei und werden verworfen (Reflog haelt sie 90 Tage). Nur Commits, die auch den Inhalt aendern, fuehren weiterhin zum Abbruch mit beiden Wegen zur Wahl. Damit entfaellt die Vorbereitung vor einem Signierlauf vollstaendig - wichtig, weil die bisher dokumentierte Vorbereitung ausgerechnet `git pull` war, also genau der Befehl, der auf einem Klon von vor dem Rewrite die entfernten Commits zurueckgeholt haette. Fuenf Lagen gegen Wegwerf-Repositories geprueft: gleich, zurueck, inhaltslos voraus, echte ungepushte Arbeit, echte Divergenz. APPLE_DEV_BACKLOG.md, OFFEN.md und AGENTS.md (Abschnitt AJ) nachgezogen. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
@@ -4916,18 +4916,30 @@ staleness bug this project keeps fixing elsewhere (cache-busting, OTA-bundle-ver
|
||||
tree is clean and `HEAD` is exactly `origin/main` (fetches first, aborts with a clear message
|
||||
otherwise) — added right after `cd "$APP"`, before the web build.
|
||||
|
||||
**Nachtrag 2026-09-07: the guard now distinguishes two cases, and the reason is a real
|
||||
trap.** On that day `main`'s history was rewritten once - three commits at the tip, all of
|
||||
which contained nothing but a document that has since moved to its own repository, were
|
||||
**Nachtrag 2026-09-07: the guard repairs the clone itself where that is provably
|
||||
lossless.** On that day `main`'s history was rewritten once - three commits at the tip, all
|
||||
of which contained nothing but a document that has since moved to its own repository, were
|
||||
removed and the branch force-pushed back to `0e84248`. **Every clone made before that date
|
||||
is now *ahead* of `origin/main`, not behind it**, so `git pull` there is exactly wrong: the
|
||||
merge pulls the removed commits back into the history, and the next push restores them on
|
||||
the server - without even needing `--force`. Git cannot tell that apart from genuine
|
||||
unpushed work, so the script does not decide: it lists the commits that exist only locally,
|
||||
names both possibilities (push them, or `git fetch origin && git reset --hard origin/main`)
|
||||
and aborts. Only the plain behind-case still recommends `git pull`. Both branches verified
|
||||
against throwaway repositories built to each shape, not just parsed - the first version of
|
||||
this fix classified the situation as "diverged" and would have told the Mac to push.
|
||||
holds commits `origin/main` does not**, so `git pull` there is exactly wrong: the merge
|
||||
pulls the removed commits back into the history, and the next push restores them on the
|
||||
server - without even needing `--force`.
|
||||
|
||||
Git cannot tell that apart from genuine unpushed work by the commit graph alone, but it can
|
||||
by the **trees**: if `HEAD`'s tree equals the merge-base's tree, the local-only commits
|
||||
contribute no content at all, and discarding them cannot lose a single file. That is the
|
||||
test the script now runs (`git diff --quiet $(git merge-base …) HEAD`). In that case it
|
||||
resets to `origin/main` itself, prints what it discarded, and carries on - the clean-tree
|
||||
check one step earlier guarantees no uncommitted work is in the way, and the reflog keeps
|
||||
the commits for 90 days. The same reasoning covers a clone that is merely **behind**: the
|
||||
script fast-forwards it rather than demanding a `git pull`, so the documented preparation
|
||||
for a signing run is now *nothing at all* - which matters, because telling a human to run
|
||||
`git pull` is precisely the instruction that would have re-created the removed commits on
|
||||
the wrong clone. Only when the local commits *do* change content does it abort and leave
|
||||
the decision to the human, naming both routes and warning off `git pull`.
|
||||
|
||||
All five shapes (equal, behind, content-free ahead, real unpushed work, genuine divergence)
|
||||
verified against throwaway repositories built to each shape, not just parsed - an earlier version of this fix
|
||||
classified the situation as "diverged" and would have told the Mac to push.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user