[Bugfix] Resolve the Hub revision once per repo (#56092)

Signed-off-by: Wauplin <lucainp@gmail.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Lucain
2026-09-24 08:48:24 -07:00
committed by GitHub
co-authored by Claude Opus 5 Harry Mellor mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent a7d203efe5
commit 344fcc252a
5 changed files with 32 additions and 22 deletions
+5
View File
@@ -63,6 +63,11 @@ def resolve_revision(
requested revision that also carries the commit hash, so downstream error
messages stay readable and offline loads reuse the cached `refs/` entry.
A commit hash only means something for the repo it was resolved against, so
a repo that is not `repo_id` needs its own call. Passing a revision resolved
for another repo back in is safe: the revision initially requested is
resolved again, against `repo_id` this time.
Returns:
The resolved revision, or `revision` unchanged if it cannot be resolved
(local path, ModelScope, or any Hub error).