]> git.phdru.name Git - git-scripts.git/blobdiff - submodules/remove
Feat(submodules/remove): Cleanup
[git-scripts.git] / submodules / remove
index 90cb02f6fc10904725a88f461df2c99902706bea..1db57c2f06353df4a4b405bd392fee3fb8f544a4 100755 (executable)
@@ -23,4 +23,12 @@ fi
 
 git rm "$path" &&
 rm -rf "`git rev-parse --git-dir`"/modules/"$name" &&
-exec git config --remove-section submodule."$name"
+git config --remove-section submodule."$name" &&
+
+if [ \! -s .gitmodules ]; then
+    git rm -f .gitmodules
+fi &&
+
+if [ -z $(ls -A "`git rev-parse --git-dir`/modules") ]; then
+    exec rmdir "`git rev-parse --git-dir`/modules"
+fi