From b925dfabc95f08959d65fb229df44d8e034b4448 Mon Sep 17 00:00:00 2001 From: LeCoffre Deployment Date: Thu, 25 Sep 2025 15:37:57 +0000 Subject: [PATCH] auto_clea --- IA_agents/prompts/prompt-global.md | 2 ++ scripts/push-ext-commit.sh | 51 +++++++++++++++--------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/IA_agents/prompts/prompt-global.md b/IA_agents/prompts/prompt-global.md index dd2598a..2f1bf06 100644 --- a/IA_agents/prompts/prompt-global.md +++ b/IA_agents/prompts/prompt-global.md @@ -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`. diff --git a/scripts/push-ext-commit.sh b/scripts/push-ext-commit.sh index ac78d7a..54aa3b6 100755 --- a/scripts/push-ext-commit.sh +++ b/scripts/push-ext-commit.sh @@ -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."