auto_clea

This commit is contained in:
LeCoffre Deployment 2025-09-25 15:37:57 +00:00
parent 55dc76fb00
commit b925dfabc9
2 changed files with 27 additions and 26 deletions

View File

@ -66,6 +66,8 @@ Tous les documents des projets doivent être dans un dossier `docs/`
- Ne créer aucune nouvelle branche git - Ne créer aucune nouvelle branche git
- Tu dois bien gérer les branche "ext" et les tags "ext" en évitant les conflit
--- ---
**Note** : Ce prompt est basé sur `4NK_env/IA_agents/prompts/prompt-global.md`. **Note** : Ce prompt est basé sur `4NK_env/IA_agents/prompts/prompt-global.md`.

View File

@ -4,6 +4,23 @@ 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} PUSH_FORCE=${PUSH_FORCE:-0}
push_branch_ext() {
# Always push explicit branch refspec to avoid conflicts with tag 'ext'
if ! git push -u origin refs/heads/ext:refs/heads/ext; then
echo "[push] branch push failed, retrying after rebase"
git fetch origin ext || true
git pull --rebase --autostash origin ext || true
if ! git push -u origin refs/heads/ext:refs/heads/ext; then
if [ "$PUSH_FORCE" = "1" ]; then
echo "[push] forcing with lease (branch ext)"
git push --force-with-lease -u origin refs/heads/ext:refs/heads/ext || return 1
else
echo "[push] still failing (set PUSH_FORCE=1 to force)"; return 1
fi
fi
fi
}
# Work from repo root # Work from repo root
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR" cd "$ROOT_DIR"
@ -42,20 +59,13 @@ 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 (then optional force-with-lease) # Ensure we are on ext branch (and not a symbolic heads/ext anomaly)
if ! git push -u origin ext; then cur_branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo ext)
echo "[submodule] push failed, retrying after rebase" if [ "$cur_branch" != "ext" ]; then
git fetch origin ext || true # Try to rename if local ref exists as refs/heads/ext
git pull --rebase --autostash origin ext || true if git show-ref --verify --quiet refs/heads/ext; then git switch ext || git branch -m "$cur_branch" ext || true; fi
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
push_branch_ext || echo "[submodule] push encountered errors for $name"
' '
echo "[root] Process root repository" echo "[root] Process root repository"
@ -81,18 +91,7 @@ git add -A
if ! git diff --cached --quiet; then if ! git diff --cached --quiet; then
git commit -m "auto_clea" git commit -m "auto_clea"
fi fi
if ! git push -u origin ext; then # Root push (explicit refspec to avoid tag/branch confusion)
echo "[root] push failed, retrying after rebase" push_branch_ext || echo "[root] push encountered errors"
git fetch origin ext || true
git pull --rebase --autostash origin ext || true
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." echo "[push-ext-commit] Done."