fix: synchronize the engine submodule URL before updating
build / mod (push) Failing after 18s

Reproduce stale upstream configuration with real local Git repositories, including the already-matching pin fast path.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
2026-11-03 00:18:41 +03:00
parent e70d7a667b
commit d3378b37a2
2 changed files with 72 additions and 4 deletions
+9 -4
View File
@@ -73,13 +73,12 @@ def engine_identity() -> str:
def fork():
"""Initialize the exact gitlink; never replace a modified developer checkout."""
expected = engine_commit()
matched = False
if (FORK / ".git").exists():
current = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=FORK, text=True).strip()
if current == expected:
print(f"horizon/: закреплённый коммит {expected}")
return
matched = current == expected
dirty = subprocess.check_output(["git", "status", "--porcelain"], cwd=FORK, text=True).strip()
if dirty:
if not matched and dirty:
sys.exit("horizon/: есть изменения при другом закреплённом SHA; сохраните их перед обновлением сабмодуля")
if (FORK / ".git").is_dir():
# Migrate the old standalone clone without deleting it or any local branches.
@@ -88,6 +87,12 @@ def fork():
run(["git", "remote", "set-url", "origin", url], cwd=FORK)
elif FORK.exists() and any(FORK.iterdir()):
sys.exit("horizon/: непустой каталог без Git; сохраните его перед инициализацией сабмодуля")
# Existing clones cache the previous upstream URL in local Git configuration.
# Synchronize even when HEAD already matches: the next pin may exist only in our fork.
run(["git", "submodule", "sync", "--recursive", "--", "horizon"], cwd=ROOT)
if matched:
print(f"horizon/: закреплённый коммит {expected}")
return
run(["git", "submodule", "update", "--init", "--recursive", "--", "horizon"], cwd=ROOT)
current = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=FORK, text=True).strip()
if current != expected: