fix: ask again for a tip older than the pin

A branch tip is cached for six hours. scummvm-standalone was pinned on
6f7b060d while the cache still held 77d80d7, its ancestor, so profile_sync
showed a HEAD behind the pin and a bump would have moved it backwards. A
tip that is a strict ancestor of the pin is now asked for again.
This commit is contained in:
Abdessamad Derraz committed 2026-10-24 02:00:21 +02:00
1 parent fecfa6be4f
commit fa7977d2c3
3 files changed
+33 -4

No files matched your search

+5 -3
View File
@@ -527,16 +527,18 @@ def current_slug(repo: Repo, cache_dir: str, offline: bool = False) -> str | Non
def resolve_head(
repo: Repo, cache_dir: str, offline: bool = False, branch: str | None = None
repo: Repo, cache_dir: str, offline: bool = False, branch: str | None = None,
fresh: bool = False,
) -> str | None:
"""Sha of a branch tip, the default branch unless one is named.
A libretro port often lives on a branch of a fork rather than on the
default branch, so the code a profile documents can be absent from the
tip the forge serves by default.
tip the forge serves by default. ``fresh`` asks the forge again whatever
the cache holds.
"""
return _first_sha(
_api(_commits_url(repo, None, branch), cache_dir, offline, MOVING_TTL)
_api(_commits_url(repo, None, branch), cache_dir, offline, 0 if fresh else MOVING_TTL)
)