fix: a recale keeps the repository word of a ref

A source_ref written as `stella src/a.c:120` names the repository its lines are in. The path is read without the word, and --rebase-refs wrote the new span back without it, losing the attribution.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 05:46:09 +02:00
1 parent 10a1f475b0
commit adea35e12a
2 files changed
+26

No files matched your search

+6
View File
@@ -1996,6 +1996,12 @@ def _rendered_part(part: PartResult) -> str:
if not raw:
return span
located = _trim_prose(_ANNOTATION_RE.sub("", raw).strip())
# `stella src/emucore/Cart.cxx:120` names the repository the lines are
# in. The path was read without that word, and a recale wrote it back
# without it: the attribution went with the old line numbers.
word, _, rest = located.partition(" ")
if rest.startswith(f"{part.part.path}:") and word and "/" not in word:
span = f"{word} {span}"
if located and located in raw:
return raw.replace(located, span, 1)
return span