+int cmd_stat(int argc, const char **argv, const char *prefix)
+{
+ struct wt_status s;
+ unsigned char sha1[20];
+ static struct option builtin_stat_options[] = {
+ OPT__VERBOSE(&verbose),
+ { OPTION_STRING, 'u', "untracked-files", &untracked_files_arg,
+ "mode",
+ "show untracked files, optional modes: all, normal, no. (Default: all)",
+ PARSE_OPT_OPTARG, NULL, (intptr_t)"all" },
+ OPT_END(),
+ };
+
+ wt_status_prepare(&s);
+ git_config(git_status_config, &s);
+ argc = parse_options(argc, argv, prefix,
+ builtin_stat_options,
+ builtin_stat_usage, 0);
+ handle_untracked_files_arg(&s);
+
+ if (*argv)
+ s.pathspec = get_pathspec(prefix, argv);
+
+ read_cache();
+ refresh_cache(REFRESH_QUIET|REFRESH_UNMERGED);
+ s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
+ wt_status_collect(&s);
+
+ s.verbose = verbose;
+ if (s.relative_paths)
+ s.prefix = prefix;
+ if (s.use_color == -1)
+ s.use_color = git_use_color_default;
+ if (diff_use_color_default == -1)
+ diff_use_color_default = git_use_color_default;
+ wt_status_print(&s);
+ return 0;
+}
+