]> git.phdru.name Git - git-scripts.git/blobdiff - git-submodules-add
Rename/move `git-submodules-add` -> `submodules/add`
[git-scripts.git] / git-submodules-add
diff --git a/git-submodules-add b/git-submodules-add
deleted file mode 100755 (executable)
index d60f9b4..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#! /bin/sh
-# Run `git submodule add` on submodules in `.gitmodules`
-# if said `.gitmodules` has been simply copied into the project.
-
-# Adapted from https://stackoverflow.com/a/53899440/7976758
-
-git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
-    while read -r KEY MODULE_PATH
-    do
-        # If the module's path exists, remove it.
-        # This is done b/c the module's path is currently 
-        # not a valid git repo and adding the submodule will cause an error.
-        [ -d "${MODULE_PATH}" ] && rm -rf "${MODULE_PATH}"
-
-        NAME="$(echo "${KEY}" | sed 's/^submodule\.\(.*\)\.path$/\1/')"
-
-        url_key="$(echo "${KEY}" | sed 's/\.path$/.url/')"
-        branch_key="$(echo "${KEY}" | sed 's/\.path$/.branch/')"
-
-        URL="$(git config -f .gitmodules --get "${url_key}")"
-        BRANCH="$(git config -f .gitmodules --get "${branch_key}")"
-
-        if [ -n "$BRANCH" ]; then
-           git submodule add --force -b "${BRANCH}" --name "${NAME}" "${URL}" "${MODULE_PATH}"
-        else
-           git submodule add --force --name "${NAME}" "${URL}" "${MODULE_PATH}"
-        fi
-    done
-
-exec git submodule update --init --recursive