5bfa389e8a
Every 'git fetch --depth 1' in 'hermes update --check' (and the past banner passive checks, before #107648 moved them to the GitHub API) appends the fetched tip to .git/shallow as a new graft and git never removes the previous one, so a long-lived shallow installer checkout accumulates one graft per check (57 observed). The stale grafts break merge-base and push 'hermes update' into the orphan-divergence reset path with a rescue ref on every run. prune_stale_shallow_grafts() now runs after each successful depth-1 fetch in 'hermes update --check' and clears the grafts already accumulated by past checks: it keeps only the boundaries still protecting referenced tips (HEAD, FETCH_HEAD, every ref tip) and atomically rewrites .git/shallow, restoring the original file if the trimmed set breaks history walking. The dropped commits are already unreachable; their objects are left for git gc. Rebased onto main after #107648: the banner.py hook is dropped (the passive check no longer git-fetches); the update --check prune and the cleanup of already-accumulated grafts are kept. (cherry picked from commit 6174837fc5b9f4cc3d4d46dc1b2d9a2f6b83c120)