X-Git-Url: https://git.phdru.name/?p=git-scripts.git;a=blobdiff_plain;f=submodules%2Fremove;fp=submodules%2Fremove;h=f9436cead70e12fdd84b414fb746d3c89aff7e83;hp=1db57c2f06353df4a4b405bd392fee3fb8f544a4;hb=b0cdb013fbb3adb2f49035e3d36ddb6e96b87253;hpb=f483adb65ce3845a400488bd289eb3b6eac4b53a diff --git a/submodules/remove b/submodules/remove index 1db57c2..f9436ce 100755 --- a/submodules/remove +++ b/submodules/remove @@ -1,8 +1,12 @@ #! /bin/sh # See https://stackoverflow.com/q/1260748/7976758 +case "$1" in + -c|--cached) cached=--cached; shift ;; +esac && + if [ $# != 1 ]; then - echo "Usage: $0 submodule_name" >&2 + echo "Usage: $0 [-c|--cached] submodule_name" >&2 exit 1 fi @@ -21,7 +25,7 @@ if [ -z "$path" ]; then exit 1 fi -git rm "$path" && +git rm $cached "$path" && rm -rf "`git rev-parse --git-dir`"/modules/"$name" && git config --remove-section submodule."$name" &&