auto_clea
This commit is contained in:
parent
55dc76fb00
commit
b925dfabc9
@ -66,6 +66,8 @@ Tous les documents des projets doivent être dans un dossier `docs/`
|
||||
|
||||
- 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`.
|
||||
|
@ -4,6 +4,23 @@ set -euo pipefail
|
||||
echo "[push-ext-commit] Ensure all submodules on ext, commit if needed, push ext"
|
||||
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
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
@ -42,20 +59,13 @@ 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 (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
|
||||
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
|
||||
# Ensure we are on ext branch (and not a symbolic heads/ext anomaly)
|
||||
cur_branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo ext)
|
||||
if [ "$cur_branch" != "ext" ]; then
|
||||
# Try to rename if local ref exists as refs/heads/ext
|
||||
if git show-ref --verify --quiet refs/heads/ext; then git switch ext || git branch -m "$cur_branch" ext || true; fi
|
||||
fi
|
||||
push_branch_ext || echo "[submodule] push encountered errors for $name"
|
||||
'
|
||||
|
||||
echo "[root] Process root repository"
|
||||
@ -81,18 +91,7 @@ git add -A
|
||||
if ! git diff --cached --quiet; then
|
||||
git commit -m "auto_clea"
|
||||
fi
|
||||
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
|
||||
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
|
||||
# Root push (explicit refspec to avoid tag/branch confusion)
|
||||
push_branch_ext || echo "[root] push encountered errors"
|
||||
|
||||
echo "[push-ext-commit] Done."
|
||||
|
Loading…
x
Reference in New Issue
Block a user