builtin/commit.c: extract ignore_non_trailer() helper function
[gitweb.git] / git-submodule.sh
index 38520db7cce2dfe03570378900489922cd9fcb8d..66f5f752c5fb6745ab409199deb775c4704ab3e6 100755 (executable)
@@ -612,11 +612,21 @@ cmd_init()
                fi
 
                # Copy "update" setting when it is not set yet
-               upd="$(git config -f .gitmodules submodule."$name".update)"
-               test -z "$upd" ||
-               test -n "$(git config submodule."$name".update)" ||
-               git config submodule."$name".update "$upd" ||
-               die "$(eval_gettext "Failed to register update mode for submodule path '\$displaypath'")"
+               if upd="$(git config -f .gitmodules submodule."$name".update)" &&
+                  test -n "$upd" &&
+                  test -z "$(git config submodule."$name".update)"
+               then
+                       case "$upd" in
+                       rebase | merge | none)
+                               ;; # known modes of updating
+                       *)
+                               echo >&2 "warning: unknown update mode '$upd' suggested for submodule '$name'"
+                               upd=none
+                               ;;
+                       esac
+                       git config submodule."$name".update "$upd" ||
+                       die "$(eval_gettext "Failed to register update mode for submodule path '\$displaypath'")"
+               fi
        done
 }
 
@@ -1036,6 +1046,13 @@ cmd_summary() {
                do
                        # Always show modules deleted or type-changed (blob<->module)
                        test $status = D -o $status = T && echo "$sm_path" && continue
+                       # Respect the ignore setting for --for-status.
+                       if test -n "$for_status"
+                       then
+                               name=$(module_name "$sm_path")
+                               ignore_config=$(get_submodule_config "$name" ignore none)
+                               test $status != A -a $ignore_config = all && continue
+                       fi
                        # Also show added or modified modules which are checked out
                        GIT_DIR="$sm_path/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&
                        echo "$sm_path"
@@ -1149,18 +1166,7 @@ cmd_summary() {
                        echo
                fi
                echo
-       done |
-       if test -n "$for_status"; then
-               if [ -n "$files" ]; then
-                       gettextln "Submodules changed but not updated:" | git stripspace -c
-               else
-                       gettextln "Submodule changes to be committed:" | git stripspace -c
-               fi
-               printf "\n" | git stripspace -c
-               git stripspace -c
-       else
-               cat
-       fi
+       done
 }
 #
 # List all submodules, prefixed with: