]> git.phdru.name Git - git-scripts.git/blobdiff - submodules/remove
Feat(submodules/remove): Find `.git` dir
[git-scripts.git] / submodules / remove
index 92efc14be3302e4621047e87c1b099b1f36a9a9a..23af550b9c80f65643013f1ae08a39e46081b8ff 100755 (executable)
@@ -6,9 +6,10 @@ if [ $# != 1 ]; then
     exit 1
 fi
 
-cd `git rev-parse --show-toplevel` || exit 1
+cd "`git rev-parse --show-toplevel`" || exit 1
 if [ \! -f .gitmodules ]; then
     echo "The command must be run in the top-level directory" >&2
+    echo "of a repository with submodules" >&2
     exit 1
 fi
 
@@ -20,6 +21,6 @@ if [ -z "$path" ]; then
     exit 1
 fi
 
-git submodule deinit -f -- "$path"
-rm -rf .git/modules/"$name"
-exec git rm -rf "$path"
+git rm "$path"
+rm -rf "git rev-parse --git-dir"/modules/"$name"
+exec git config --remove-section submodule."$name"