auto_clea
This commit is contained in:
parent
c0b3bda6da
commit
1a4d5c4703
@ -2,6 +2,7 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
echo "[push-ext-commit] Ensure all submodules on ext, commit if needed, push ext"
|
echo "[push-ext-commit] Ensure all submodules on ext, commit if needed, push ext"
|
||||||
|
PUSH_FORCE=${PUSH_FORCE:-0}
|
||||||
|
|
||||||
# Work from repo root
|
# Work from repo root
|
||||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
@ -41,12 +42,19 @@ git submodule foreach --recursive '
|
|||||||
if ! git diff --cached --quiet; then
|
if ! git diff --cached --quiet; then
|
||||||
git commit -m "auto_clea"
|
git commit -m "auto_clea"
|
||||||
fi
|
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
|
if ! git push -u origin ext; then
|
||||||
echo "[submodule] push failed, retrying after rebase"
|
echo "[submodule] push failed, retrying after rebase"
|
||||||
git fetch origin ext || true
|
git fetch origin ext || true
|
||||||
git pull --rebase --autostash 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
|
fi
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -77,7 +85,14 @@ if ! git push -u origin ext; then
|
|||||||
echo "[root] push failed, retrying after rebase"
|
echo "[root] push failed, retrying after rebase"
|
||||||
git fetch origin ext || true
|
git fetch origin ext || true
|
||||||
git pull --rebase --autostash 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
|
fi
|
||||||
|
|
||||||
echo "[push-ext-commit] Done."
|
echo "[push-ext-commit] Done."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user