fix(scripts): surgical-clean honors submodules with .git file (gitdir pointer)

Made-with: Cursor
This commit is contained in:
defiQUG
2026-04-07 22:48:05 -07:00
parent b117585cfd
commit 86a250f188

View File

@@ -30,7 +30,7 @@ log() { echo "[surgical-clean] $*"; }
clean_the_order() {
local sub="$ROOT/the-order"
[[ -d "$sub/.git" ]] || return 0
[[ -e "$sub/.git" ]] || return 0
log "the-order: ensure .gitignore rules for packages/**/src emit"
if $DRY; then
grep -q 'packages/\*\*/src/\*\*' "$sub/.gitignore" 2>/dev/null && log " (gitignore already has package src emit rules)"
@@ -58,7 +58,7 @@ clean_the_order() {
clean_smom() {
local sub="$ROOT/smom-dbis-138"
[[ -d "$sub/.git" ]] || return 0
[[ -e "$sub/.git" ]] || return 0
local n
n=$(git -C "$sub" ls-files 2>/dev/null | grep -c '^artifacts/' || true)
if [[ "${n:-0}" -eq 0 ]]; then
@@ -78,7 +78,7 @@ clean_smom() {
clean_metamask_integration() {
local sub="$ROOT/metamask-integration"
[[ -d "$sub/.git" ]] || return 0
[[ -e "$sub/.git" ]] || return 0
log "metamask-integration: ensure root .gitignore has dist/"
if ! $DRY && [[ -f "$sub/.gitignore" ]] && ! grep -qE '^dist/?$' "$sub/.gitignore" 2>/dev/null; then
log " WARN: add dist/ to metamask-integration/.gitignore (tsc outDir)"
@@ -99,7 +99,7 @@ clean_metamask_integration() {
clean_miracles_in_motion() {
local sub="$ROOT/miracles_in_motion"
[[ -d "$sub/.git" ]] || return 0
[[ -e "$sub/.git" ]] || return 0
local files
files=$(git -C "$sub" ls-files 2>/dev/null | grep '^api/deploy-package/' | grep -vE '(host\.json|package\.json)$' || true)
if [[ -z "${files// }" ]]; then