parse-options: support --git-completion-helper
[gitweb.git] / git-submodule.sh
index 66d1ae8ef6c5f12c856a2f88eabce515dcafd489..156255a9e56e7a5930f3f652ee38994064db03ea 100755 (executable)
@@ -758,18 +758,6 @@ cmd_update()
        }
 }
 
-set_name_rev () {
-       revname=$( (
-               sanitize_submodule_env
-               cd "$1" && {
-                       git describe "$2" 2>/dev/null ||
-                       git describe --tags "$2" 2>/dev/null ||
-                       git describe --contains "$2" 2>/dev/null ||
-                       git describe --all --always "$2"
-               }
-       ) )
-       test -z "$revname" || revname=" ($revname)"
-}
 #
 # Show commit summary for submodules in index or working tree
 #
@@ -1016,54 +1004,7 @@ cmd_status()
                shift
        done
 
-       {
-               git submodule--helper list --prefix "$wt_prefix" "$@" ||
-               echo "#unmatched" $?
-       } |
-       while read -r mode sha1 stage sm_path
-       do
-               die_if_unmatched "$mode" "$sha1"
-               name=$(git submodule--helper name "$sm_path") || exit
-               displaypath=$(git submodule--helper relative-path "$prefix$sm_path" "$wt_prefix")
-               if test "$stage" = U
-               then
-                       say "U$sha1 $displaypath"
-                       continue
-               fi
-               if ! git submodule--helper is-active "$sm_path" ||
-               {
-                       ! test -d "$sm_path"/.git &&
-                       ! test -f "$sm_path"/.git
-               }
-               then
-                       say "-$sha1 $displaypath"
-                       continue;
-               fi
-               if git diff-files --ignore-submodules=dirty --quiet -- "$sm_path"
-               then
-                       set_name_rev "$sm_path" "$sha1"
-                       say " $sha1 $displaypath$revname"
-               else
-                       if test -z "$cached"
-                       then
-                               sha1=$(sanitize_submodule_env; cd "$sm_path" && git rev-parse --verify HEAD)
-                       fi
-                       set_name_rev "$sm_path" "$sha1"
-                       say "+$sha1 $displaypath$revname"
-               fi
-
-               if test -n "$recursive"
-               then
-                       (
-                               prefix="$displaypath/"
-                               sanitize_submodule_env
-                               wt_prefix=
-                               cd "$sm_path" &&
-                               eval cmd_status
-                       ) ||
-                       die "$(eval_gettext "Failed to recurse into submodule path '\$sm_path'")"
-               fi
-       done
+       git ${wt_prefix:+-C "$wt_prefix"} ${prefix:+--super-prefix "$prefix"} submodule--helper status ${GIT_QUIET:+--quiet} ${cached:+--cached} ${recursive:+--recursive} "$@"
 }
 #
 # Sync remote urls for submodules