Skip to content

Commit 927acc3

Browse files
committed
fix(release): explicit full-SHA lease for first-release force-push
Bare --force-with-lease rejected config's main with 'stale info' during the 0.0.71-lpb release even though the tracking ref matched the remote (reproduced on git 2.53 against GitHub). Pin the lease to the exact SHA fetched in this run.
1 parent 511ca9c commit 927acc3

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

scripts/localpibox/stack/release.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,22 @@ def cmd_release_promote(*, assume_yes: bool, dry_run: bool, rebase: bool,
596596
continue
597597
push_args = ["push", "origin", main_b]
598598
if label in rebased:
599-
push_args = ["push", "--force-with-lease", "origin", main_b]
599+
# Explicit lease pinned to the exact remote SHA this run
600+
# fetched. Bare --force-with-lease (which derives the expected
601+
# value from refs/remotes/origin/<stable>) rejects with
602+
# "stale info" in this environment (observed on git 2.53
603+
# against GitHub) even when the tracking ref matches the
604+
# remote — an explicit full-SHA lease does not.
605+
full, _err, code = git(path, "rev-parse", "--verify",
606+
f"origin/{main_b}")
607+
if code != 0 or not full.strip():
608+
cons.error(f" {label}: cannot resolve origin/{main_b} — "
609+
"skipping force-push")
610+
failures.append(label)
611+
continue
612+
push_args = ["push",
613+
f"--force-with-lease={main_b}:{full.strip()}",
614+
"origin", main_b]
600615
cons.info(f" pushing {gh}:{main_b} …")
601616
out, err, code = git_auth(path, *push_args, timeout=180)
602617
if code != 0:

0 commit comments

Comments
 (0)