fix: self-check a ref in every repository

A prose citation of the port's own lines was read only in the upstream file that a source_ref attributes the path to, and a range past that file's end came back GONE although the port carries it.
This commit is contained in:
Abdessamad Derraz committed 2026-10-21 06:18:00 +02:00
1 parent 82acd55ebc
commit 5ce7ab8386
2 files changed
+44

No files matched your search

+19
View File
@@ -1786,6 +1786,25 @@ def build_report(
owner, _actual = resolve_path(part.path, part.start, tuple(tokens))
if result.repo is None and owner is not primary:
result = replace(result, repo=owner.repo.slug)
if result.status == "GONE":
# The owner is chosen on the cited first line alone. hatari's
# port carries a longer src/paths.c than the upstream that a
# source_ref attributes the path to, and prose citing the
# port's 305-356 read past the end of the upstream's 345
# lines. As in a comparison, a ref fails only everywhere.
for view in views:
if view is owner or view.pin != view.head:
continue
lines = fetch_from(view.repo, view.pin, part.path)
if lines is None:
continue
found = verify_at_pin(part, lines, tokens, hashes)
if found.status != "GONE":
result = replace(
found,
repo=None if view is primary else view.repo.slug,
)
break
else:
result = anchor_across_views(part, tokens)
# A forge that refused the request said nothing about the file: