auto_clea

This commit is contained in:
LeCoffre Deployment 2025-09-25 15:27:56 +00:00
parent c0b3bda6da
commit 1a4d5c4703

View File

@ -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."