fix: name the stale pin instead of a missing file

A ref whose file is absent at the pinned revision reported "pin revision
missing", which reads as code that vanished. When the same file is at
HEAD and the cited range fits it, nothing vanished: the ref was written
against HEAD while source_commit still names an older revision, and the
profile describes two trees at once. The reason now says so, because the
fix is the pin and not a hunt for a move that never happened.

This is the state three profiles were left in during their own
reprofiling, against a warning the repository already carries. A range
that overruns HEAD stays a plain miss, and a file absent from both
revisions is unchanged.
This commit is contained in:
Abdessamad Derraz committed 2026-09-04 16:45:51 +02:00
1 parent 05b08d6e39
commit 1fb717324b
2 files changed
+41 -3

No files matched your search

+8 -3
View File
@@ -815,9 +815,14 @@ def anchor_part(
# the old path at the pin, which is why that one is tried first.
pin_lines = fetch(PIN, path, part.start, tokens)
if pin_lines is None:
return PartResult(
part, "GONE", None, None, None, [], "pin revision missing", slug, url
)
# Present at HEAD, absent at the pin, and the cited range fits the
# HEAD file: the ref was written against HEAD while source_commit
# still names an older revision. Saying "missing" sends the reader
# hunting for a move that never happened; the fix is the pin.
reason = "pin revision missing"
if head_lines is not None and part.start <= len(head_lines):
reason = "written against HEAD, pin names an older revision"
return PartResult(part, "GONE", None, None, None, [], reason, slug, url)
end = part.end or part.start
anchored = anchor_block(pin_lines, head_lines, part.start, end)