From 1a4d5c47039aa5873f36ea78c32a7f99e8e2fae4 Mon Sep 17 00:00:00 2001 From: LeCoffre Deployment Date: Thu, 25 Sep 2025 15:27:56 +0000 Subject: [PATCH] auto_clea --- scripts/push-ext-commit.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/push-ext-commit.sh b/scripts/push-ext-commit.sh index 68de7ac..ac78d7a 100755 --- a/scripts/push-ext-commit.sh +++ b/scripts/push-ext-commit.sh @@ -2,6 +2,7 @@ set -euo pipefail echo "[push-ext-commit] Ensure all submodules on ext, commit if needed, push ext" +PUSH_FORCE=${PUSH_FORCE:-0} # Work from repo root ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" @@ -41,12 +42,19 @@ git submodule foreach --recursive ' if ! git diff --cached --quiet; then git commit -m "auto_clea" fi - # Push with upstream set; handle non-FF by one-time rebase+retry + # Push with upstream set; handle non-FF by one-time rebase+retry (then optional force-with-lease) if ! git push -u origin ext; then echo "[submodule] push failed, retrying after rebase" git fetch origin ext || true git pull --rebase --autostash origin ext || true - git push -u origin ext || echo "[submodule] push still failing for $name" + if ! git push -u origin ext; then + if [ "$PUSH_FORCE" = "1" ]; then + echo "[submodule] rebase push failed, forcing with lease" + git push --force-with-lease -u origin ext || echo "[submodule] push still failing for $name" + else + echo "[submodule] push still failing for $name (set PUSH_FORCE=1 to force)" + fi + fi fi ' @@ -77,7 +85,14 @@ if ! git push -u origin ext; then echo "[root] push failed, retrying after rebase" git fetch origin ext || true git pull --rebase --autostash origin ext || true - git push -u origin ext || echo "[root] push still failing" + if ! git push -u origin ext; then + if [ "$PUSH_FORCE" = "1" ]; then + echo "[root] rebase push failed, forcing with lease" + git push --force-with-lease -u origin ext || echo "[root] push still failing" + else + echo "[root] push still failing (set PUSH_FORCE=1 to force)" + fi + fi fi echo "[push-ext-commit] Done."