@@ -485,6 +485,7 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
485485static int run_status (FILE * fp , const char * index_file , const char * prefix , int nowarn ,
486486 struct wt_status * s )
487487{
488+ struct wt_status_state state ;
488489 struct object_id oid ;
489490
490491 if (s -> relative_paths )
@@ -504,10 +505,12 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
504505 s -> status_format = status_format ;
505506 s -> ignore_submodule_arg = ignore_submodule_arg ;
506507
507- wt_status_collect (s );
508- wt_status_print (s );
508+ wt_status_get_state (s , & state );
509+ wt_status_collect (s , & state );
510+ wt_status_print (s , & state );
511+ wt_status_clear_state (& state );
509512
510- return s -> commitable ;
513+ return s -> committable ;
511514}
512515
513516static int is_a_merge (const struct commit * current_head )
@@ -653,7 +656,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
653656{
654657 struct stat statbuf ;
655658 struct strbuf committer_ident = STRBUF_INIT ;
656- int commitable ;
659+ int committable ;
657660 struct strbuf sb = STRBUF_INIT ;
658661 const char * hook_arg1 = NULL ;
659662 const char * hook_arg2 = NULL ;
@@ -870,7 +873,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
870873
871874 saved_color_setting = s -> use_color ;
872875 s -> use_color = 0 ;
873- commitable = run_status (s -> fp , index_file , prefix , 1 , s );
876+ committable = run_status (s -> fp , index_file , prefix , 1 , s );
874877 s -> use_color = saved_color_setting ;
875878 } else {
876879 struct object_id oid ;
@@ -888,7 +891,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
888891 for (i = 0 ; i < active_nr ; i ++ )
889892 if (ce_intent_to_add (active_cache [i ]))
890893 ita_nr ++ ;
891- commitable = active_nr - ita_nr > 0 ;
894+ committable = active_nr - ita_nr > 0 ;
892895 } else {
893896 /*
894897 * Unless the user did explicitly request a submodule
@@ -904,7 +907,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
904907 if (ignore_submodule_arg &&
905908 !strcmp (ignore_submodule_arg , "all" ))
906909 flags .ignore_submodules = 1 ;
907- commitable = index_differs_from (parent , & flags , 1 );
910+ committable = index_differs_from (parent , & flags , 1 );
908911 }
909912 }
910913 strbuf_release (& committer_ident );
@@ -916,7 +919,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
916919 * explicit --allow-empty. In the cherry-pick case, it may be
917920 * empty due to conflict resolution, which the user should okay.
918921 */
919- if (!commitable && whence != FROM_MERGE && !allow_empty &&
922+ if (!committable && whence != FROM_MERGE && !allow_empty &&
920923 !(amend && is_a_merge (current_head ))) {
921924 s -> display_comment_prefix = old_display_comment_prefix ;
922925 run_status (stdout , index_file , prefix , 0 , s );
@@ -1186,14 +1189,14 @@ static int parse_and_validate_options(int argc, const char *argv[],
11861189static int dry_run_commit (int argc , const char * * argv , const char * prefix ,
11871190 const struct commit * current_head , struct wt_status * s )
11881191{
1189- int commitable ;
1192+ int committable ;
11901193 const char * index_file ;
11911194
11921195 index_file = prepare_index (argc , argv , prefix , current_head , 1 );
1193- commitable = run_status (stdout , index_file , prefix , 0 , s );
1196+ committable = run_status (stdout , index_file , prefix , 0 , s );
11941197 rollback_index_files ();
11951198
1196- return commitable ? 0 : 1 ;
1199+ return committable ? 0 : 1 ;
11971200}
11981201
11991202define_list_config_array_extra (color_status_slots , {"added" });
@@ -1295,6 +1298,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
12951298 static int no_renames = -1 ;
12961299 static const char * rename_score_arg = (const char * )-1 ;
12971300 static struct wt_status s ;
1301+ struct wt_status_state state ;
12981302 int fd ;
12991303 struct object_id oid ;
13001304 static struct option builtin_status_options [] = {
@@ -1379,15 +1383,17 @@ int cmd_status(int argc, const char **argv, const char *prefix)
13791383 s .rename_score = parse_rename_score (& rename_score_arg );
13801384 }
13811385
1382- wt_status_collect (& s );
1386+ wt_status_get_state (& s , & state );
1387+ wt_status_collect (& s , & state );
13831388
13841389 if (0 <= fd )
13851390 update_index_if_able (& the_index , & index_lock );
13861391
13871392 if (s .relative_paths )
13881393 s .prefix = prefix ;
13891394
1390- wt_status_print (& s );
1395+ wt_status_print (& s , & state );
1396+ wt_status_clear_state (& state );
13911397 return 0 ;
13921398}
13931399
0 commit comments