@@ -83,10 +83,18 @@ jobs:
8383 # Get list of submodules
8484 git config --file .gitmodules --get-regexp path | awk '{ print $2 }' > /tmp/submodule_paths.txt
8585
86+ # Remove each submodule from git's index (but keep the files)
87+ while IFS= read -r submodule_path; do
88+ if [ -d "$submodule_path" ]; then
89+ echo "Removing submodule from index: $submodule_path"
90+ git rm --cached "$submodule_path" || true
91+ fi
92+ done < /tmp/submodule_paths.txt
93+
8694 # Remove .git directories from submodules (converts them to regular directories)
8795 while IFS= read -r submodule_path; do
8896 if [ -d "$submodule_path/.git" ]; then
89- echo "Flattening submodule : $submodule_path"
97+ echo "Removing .git directory : $submodule_path/.git "
9098 rm -rf "$submodule_path/.git"
9199 fi
92100 done < /tmp/submodule_paths.txt
@@ -96,8 +104,16 @@ jobs:
96104 git config --remove-section submodule.docs/notebooks || true
97105 git config --remove-section submodule.docs/faq || true
98106
99- # Stage all changes (submodule content will now be tracked as regular files)
100- git add -A
107+ # Add submodule content back as regular files
108+ while IFS= read -r submodule_path; do
109+ if [ -d "$submodule_path" ]; then
110+ echo "Adding submodule content as regular files: $submodule_path"
111+ git add "$submodule_path/"
112+ fi
113+ done < /tmp/submodule_paths.txt
114+
115+ # Stage removal of .gitmodules
116+ git add .gitmodules || true
101117
102118 # Configure git user for commit
103119 git config user.name "github-actions[bot]"
0 commit comments