delete empty .gitmodules

This commit is contained in:
go2null 2019-10-20 12:42:00 -04:00 committed by Test Script
parent 2883b67644
commit 4a47ea034b

View file

@ -6,8 +6,8 @@ test ! -f .gitmodules && echo ".gitmodules file not found" 1>&2 && exit 2
NAME="$(echo "$1" | sed 's/\/$//g')"
test -z \
"$(git config --file=.gitmodules submodule."$NAME".url)" \
&& echo "submodule not found" 1>&2 && exit 3
"$( git config --file=.gitmodules submodule."$NAME".url)" \
&& echo "submodule not found" 1>&2 && exit 3
# 1. Delete the relevant section from .git/config and clean submodule files
git submodule deinit -f "$NAME" || exit 4
@ -16,6 +16,8 @@ rm -rf .git/modules/"$NAME"
# 2. Delete the relevant line from .gitmodules
git config --file=.gitmodules --remove-section submodule."$NAME"
git add .gitmodules
# 2.a Delete empty .gitmodules
[ "$(wc -l '.gitmodules' | cut -d' ' -f1)" = '0' ] && git rm -f '.gitmodules'
# 3. Run git rm --cached path_to_submodule
git rm --cached -rf "$NAME"
# 4. Need to confirm and commit the changes for yourself