mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-25 21:29:05 -05:00
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:
1 parent
fecfa6be4f
commit
fa7977d2c3
3 files changed
+33
-4
No files matched your search
@@ -1182,7 +1182,10 @@ class TestBuildReport(unittest.TestCase):
|
||||
profile_sync.upstream.list_gitlinks,
|
||||
profile_sync.upstream.current_slug,
|
||||
profile_sync.upstream.fork_base,
|
||||
profile_sync.upstream.ancestry,
|
||||
)
|
||||
# Pin and tip are unrelated shas in these fixtures: no ancestry.
|
||||
profile_sync.upstream.ancestry = lambda *a, **k: None
|
||||
self.fork_bases: dict[str, str] = {}
|
||||
profile_sync.upstream.fork_base = (
|
||||
lambda repo, sha, fork, fork_sha, cache_dir, offline=False:
|
||||
@@ -1226,7 +1229,7 @@ class TestBuildReport(unittest.TestCase):
|
||||
)
|
||||
)
|
||||
profile_sync.upstream.resolve_head = (
|
||||
lambda repo, cache_dir, offline=False, branch=None: "headsha"
|
||||
lambda repo, cache_dir, offline=False, branch=None, fresh=False: "headsha"
|
||||
)
|
||||
profile_sync.upstream.resolve_commit_at = (
|
||||
lambda repo, date, cache_dir, offline=False, branch=None: "pinsha"
|
||||
@@ -1250,6 +1253,7 @@ class TestBuildReport(unittest.TestCase):
|
||||
profile_sync.upstream.list_gitlinks,
|
||||
profile_sync.upstream.current_slug,
|
||||
profile_sync.upstream.fork_base,
|
||||
profile_sync.upstream.ancestry,
|
||||
) = self._orig
|
||||
self.tmp.cleanup()
|
||||
|
||||
@@ -5034,6 +5038,22 @@ class UpstreamForkedByThePort(unittest.TestCase):
|
||||
self.assertEqual(views[1].head, "up-tip")
|
||||
|
||||
|
||||
class ACachedTipOlderThanThePin(TestBuildReport):
|
||||
"""scummvm-standalone was pinned on 6f7b060d while the cached tip was
|
||||
77d80d7, its ancestor: a bump would have moved the pin backwards."""
|
||||
|
||||
def test_the_tip_is_asked_again(self):
|
||||
profile_sync.upstream.ancestry = lambda *a, **k: (0, 3)
|
||||
profile_sync.upstream.resolve_head = (
|
||||
lambda repo, cache_dir, offline=False, branch=None, fresh=False:
|
||||
"newtip" if fresh else "staletip"
|
||||
)
|
||||
self.files[("pinsha", "a.c")] = ["x", "hit"]
|
||||
self.files[("newtip", "a.c")] = ["x", "hit"]
|
||||
report = build_report("test", self._profile(["a.c:2"]), self.dir)
|
||||
self.assertEqual(report.head, "newtip")
|
||||
|
||||
|
||||
class OfflineCacheMissIsNotGone(TestBuildReport):
|
||||
"""Offline, a file the cache never stored came back as None and the
|
||||
report read "GONE (absent at HEAD, no rename found)" for files that
|
||||
|
||||
Reference in new issue
Block a user