diff --git a/bash/functions/infra/discover_git_repos.sh b/bash/functions/infra/discover_git_repos.sh index e383f7f5..c063df7a 100644 --- a/bash/functions/infra/discover_git_repos.sh +++ b/bash/functions/infra/discover_git_repos.sh @@ -22,11 +22,12 @@ discover_git_repos() { results+=("$abs_root") fi - # Buscar .git/ en subdirectorios, con exclusiones - while IFS= read -r git_dir; do - local repo_dir="${git_dir%/.git}" + # Buscar .git en subdirectorios, con exclusiones. + # Sin -type d: cubre tambien .git como archivo (submodulos + worktrees). + while IFS= read -r git_path; do + local repo_dir="${git_path%/.git}" results+=("$repo_dir") - done < <(find "$abs_root" -mindepth 2 -name ".git" -type d \ + done < <(find "$abs_root" -mindepth 2 -name ".git" \ -not -path "*/.git/*" \ -not -path "*/node_modules/*" \ -not -path "*/.venv/*" \ diff --git a/bash/functions/pipelines/full_git_push.sh b/bash/functions/pipelines/full_git_push.sh index 44297463..36738157 100644 --- a/bash/functions/pipelines/full_git_push.sh +++ b/bash/functions/pipelines/full_git_push.sh @@ -44,42 +44,22 @@ full_git_push() { export GITEA_TOKEN="$gitea_token" export FN_REGISTRY_INFRA_DIR="$INFRA_DIR" - local missing_dirs=() - for pattern in "apps/*/" "analysis/*/" "projects/*/apps/*/" "projects/*/analysis/*/"; do - while IFS= read -r d; do - d="${d%/}" - if [[ -d "$d" && ! -d "$d/.git" ]]; then - missing_dirs+=("$d") - fi - done < <(find "$registry_root" -maxdepth 4 -type d -name "$(basename "$pattern")" 2>/dev/null | grep -E "$pattern" || true) - done - - # Forma mas directa: iterar directorios conocidos - for pattern in apps analysis; do - if [[ -d "$registry_root/$pattern" ]]; then - for d in "$registry_root/$pattern"/*/; do - d="${d%/}" - [[ -d "$d" ]] || continue - [[ -d "$d/.git" ]] && continue - echo " auto-init: $d" >&2 - ensure_repo_synced "$d" dataforge "$(basename "$d")" master "chore: initial sync" || \ - echo " [warn] fallo inicializando $d" >&2 - done - fi - done - for proj in "$registry_root"/projects/*/; do - for subdir in apps analysis; do - [[ -d "$proj$subdir" ]] || continue - for d in "$proj$subdir"/*/; do - d="${d%/}" - [[ -d "$d" ]] || continue - [[ -d "$d/.git" ]] && continue - echo " auto-init: $d" >&2 - ensure_repo_synced "$d" dataforge "$(basename "$d")" master "chore: initial sync" || \ - echo " [warn] fallo inicializando $d" >&2 - done - done - done + # BD-driven: itera TODOS los dir_path de apps y analyses indexados. + # Cubre apps/, cpp/apps/, projects/
/apps/, analysis/, projects/
/analysis/ + # y cualquier ubicacion futura sin tocar este codigo. + if [[ -f "$registry_root/registry.db" ]] && command -v sqlite3 >/dev/null 2>&1; then + while IFS= read -r dir_path; do + [[ -z "$dir_path" ]] && continue + local d="$registry_root/$dir_path" + [[ -d "$d" ]] || continue + [[ -d "$d/.git" ]] && continue + echo " auto-init: $d" >&2 + ensure_repo_synced "$d" dataforge "$(basename "$d")" master "chore: initial sync" || \ + echo " [warn] fallo inicializando $d" >&2 + done < <(sqlite3 "$registry_root/registry.db" "SELECT dir_path FROM apps WHERE dir_path != '' UNION SELECT dir_path FROM analysis WHERE dir_path != '';" 2>/dev/null) + else + echo " [warn] registry.db o sqlite3 no disponibles — omitiendo auto-init BD-driven" >&2 + fi else echo " [skip] GITEA_URL/GITEA_TOKEN no disponibles — omitiendo auto-init" >&2 fi