feat(git): enhance git folder scripts with validation and error handling for missing submodules and existing directories

This commit is contained in:
Janik von Rotz committed 2026-03-04 10:42:13 +01:00
1 parent 84f7ebfccb
commit e640a36e69
4 files changed
+31 -8

No files matched your search

+11 -4
View File
@@ -12,11 +12,18 @@ pull-git-folder() {
local git_folders=$(ls-git-folder "$2")
for git_folder in $git_folders; do
git_folder="${git_folder#./}"
local git_folder_path=$(git config --file .gitmodules --get submodule."$git_folder".path)
local git_folder_url=$(git config --file .gitmodules --get submodule."$git_folder".url)
if [[ -z "$git_folder_path" ]] || [[ -z "$git_folder_url" ]]; then
echo "Skipping: '$git_folder' not defined in .gitmodules."
continue
fi
echo "Pull git folder $git_folder."
git -C "$git_folder" stash
local update=$(git config submodule."$git_folder".update)
if [[ -z "$update" ]]; then
git -C "$git_folder" pull origin "$1"
fi;
git -C "$git_folder" pull origin "$1"
done
}