add update 'none' flag to disable update of submodule by default
[gitweb.git] / git-submodule.sh
index bc1d3fa663a5eb39dd96f6ad2ca17437073ceb0a..34d2be6ef0a3373608ff8b89f59ed19043c59354 100755 (executable)
@@ -122,12 +122,17 @@ module_clone()
        path=$1
        url=$2
        reference="$3"
+       quiet=
+       if test -n "$GIT_QUIET"
+       then
+               quiet=-q
+       fi
 
        if test -n "$reference"
        then
-               git-clone "$reference" -n "$url" "$path"
+               git-clone $quiet "$reference" -n "$url" "$path"
        else
-               git-clone -n "$url" "$path"
+               git-clone $quiet -n "$url" "$path"
        fi ||
        die "$(eval_gettext "Clone of '\$url' into submodule path '\$path' failed")"
 }
@@ -424,6 +429,9 @@ cmd_update()
                --recursive)
                        recursive=1
                        ;;
+               --checkout)
+                       update="checkout"
+                       ;;
                --)
                        shift
                        break
@@ -456,7 +464,19 @@ cmd_update()
                fi
                name=$(module_name "$path") || exit
                url=$(git config submodule."$name".url)
-               update_module=$(git config submodule."$name".update)
+               if ! test -z "$update"
+               then
+                       update_module=$update
+               else
+                       update_module=$(git config submodule."$name".update)
+               fi
+
+               if test "$update_module" = "none"
+               then
+                       echo "Skipping submodule '$path'"
+                       continue
+               fi
+
                if test -z "$url"
                then
                        # Only mention uninitialized submodules when its
@@ -478,11 +498,6 @@ Maybe you want to use 'update --init'?")"
                        die "$(eval_gettext "Unable to find current revision in submodule path '\$path'")"
                fi
 
-               if ! test -z "$update"
-               then
-                       update_module=$update
-               fi
-
                if test "$subsha1" != "$sha1"
                then
                        subforce=$force