]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-submodule.sh
Sync with 2.16.6
[thirdparty/git.git] / git-submodule.sh
index 24914963ca23c837e0cc46ca2dc0fa46bf9886a6..73594e0e35d094a329fecbe3e59e2aac6630ad6c 100755 (executable)
@@ -34,6 +34,7 @@ reference=
 cached=
 recursive=
 init=
+require_init=
 files=
 remote=
 nofetch=
@@ -229,6 +230,11 @@ Use -f if you really want to add it." >&2
                sm_name="$sm_path"
        fi
 
+       if ! git submodule--helper check-name "$sm_name"
+       then
+               die "$(eval_gettext "'$sm_name' is not a valid submodule name")"
+       fi
+
        # perhaps the path exists and is already a git repo, else clone it
        if test -e "$sm_path"
        then
@@ -470,6 +476,10 @@ cmd_update()
                -i|--init)
                        init=1
                        ;;
+               --require-init)
+                       init=1
+                       require_init=1
+                       ;;
                --remote)
                        remote=1
                        ;;
@@ -548,6 +558,7 @@ cmd_update()
                ${update:+--update "$update"} \
                ${reference:+"$reference"} \
                ${depth:+--depth "$depth"} \
+               ${require_init:+--require-init} \
                ${recommend_shallow:+"$recommend_shallow"} \
                ${jobs:+$jobs} \
                "$@" || echo "#unmatched" $?