git-sh-setup.sh: add variable to use the stuck-long mode
[gitweb.git] / git-submodule.sh
index ed02f032140e0e93fd920f591f41bc328a071833..4a30087768a16d77bfcec41889f58b64fdf5f89c 100755 (executable)
@@ -622,7 +622,7 @@ cmd_init()
                   test -z "$(git config submodule."$name".update)"
                then
                        case "$upd" in
-                       rebase | merge | none)
+                       checkout | rebase | merge | none)
                                ;; # known modes of updating
                        *)
                                echo >&2 "warning: unknown update mode '$upd' suggested for submodule '$name'"
@@ -721,7 +721,6 @@ cmd_deinit()
 cmd_update()
 {
        # parse $args after "submodule ... update".
-       orig_flags=
        while test $# -ne 0
        do
                case "$1" in
@@ -746,7 +745,6 @@ cmd_update()
                --reference)
                        case "$2" in '') usage ;; esac
                        reference="--reference=$2"
-                       orig_flags="$orig_flags $(git rev-parse --sq-quote "$1")"
                        shift
                        ;;
                --reference=*)
@@ -780,7 +778,6 @@ cmd_update()
                        break
                        ;;
                esac
-               orig_flags="$orig_flags $(git rev-parse --sq-quote "$1")"
                shift
        done
 
@@ -808,6 +805,17 @@ cmd_update()
                        update_module=$update
                else
                        update_module=$(git config submodule."$name".update)
+                       case "$update_module" in
+                       '')
+                               ;; # Unset update mode
+                       checkout | rebase | merge | none)
+                               ;; # Known update modes
+                       !*)
+                               ;; # Custom update command
+                       *)
+                               die "$(eval_gettext "Invalid update mode '$update_module' for submodule '$name'")"
+                               ;;
+                       esac
                fi
 
                displaypath=$(relative_path "$prefix$sm_path")
@@ -924,7 +932,7 @@ Maybe you want to use 'update --init'?")"
                                prefix="$prefix$sm_path/"
                                clear_local_git_env
                                cd "$sm_path" &&
-                               eval cmd_update "$orig_flags"
+                               eval cmd_update
                        )
                        res=$?
                        if test $res -gt 0