@@ -485,6 +485,7 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
485
485
static int run_status (FILE * fp , const char * index_file , const char * prefix , int nowarn ,
486
486
struct wt_status * s )
487
487
{
488
+ struct wt_status_state state ;
488
489
struct object_id oid ;
489
490
490
491
if (s -> relative_paths )
@@ -504,10 +505,12 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
504
505
s -> status_format = status_format ;
505
506
s -> ignore_submodule_arg = ignore_submodule_arg ;
506
507
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 );
509
512
510
- return s -> commitable ;
513
+ return s -> committable ;
511
514
}
512
515
513
516
static 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,
653
656
{
654
657
struct stat statbuf ;
655
658
struct strbuf committer_ident = STRBUF_INIT ;
656
- int commitable ;
659
+ int committable ;
657
660
struct strbuf sb = STRBUF_INIT ;
658
661
const char * hook_arg1 = NULL ;
659
662
const char * hook_arg2 = NULL ;
@@ -870,7 +873,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
870
873
871
874
saved_color_setting = s -> use_color ;
872
875
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 );
874
877
s -> use_color = saved_color_setting ;
875
878
} else {
876
879
struct object_id oid ;
@@ -888,7 +891,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
888
891
for (i = 0 ; i < active_nr ; i ++ )
889
892
if (ce_intent_to_add (active_cache [i ]))
890
893
ita_nr ++ ;
891
- commitable = active_nr - ita_nr > 0 ;
894
+ committable = active_nr - ita_nr > 0 ;
892
895
} else {
893
896
/*
894
897
* Unless the user did explicitly request a submodule
@@ -904,7 +907,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
904
907
if (ignore_submodule_arg &&
905
908
!strcmp (ignore_submodule_arg , "all" ))
906
909
flags .ignore_submodules = 1 ;
907
- commitable = index_differs_from (parent , & flags , 1 );
910
+ committable = index_differs_from (parent , & flags , 1 );
908
911
}
909
912
}
910
913
strbuf_release (& committer_ident );
@@ -916,7 +919,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
916
919
* explicit --allow-empty. In the cherry-pick case, it may be
917
920
* empty due to conflict resolution, which the user should okay.
918
921
*/
919
- if (!commitable && whence != FROM_MERGE && !allow_empty &&
922
+ if (!committable && whence != FROM_MERGE && !allow_empty &&
920
923
!(amend && is_a_merge (current_head ))) {
921
924
s -> display_comment_prefix = old_display_comment_prefix ;
922
925
run_status (stdout , index_file , prefix , 0 , s );
@@ -1186,14 +1189,14 @@ static int parse_and_validate_options(int argc, const char *argv[],
1186
1189
static int dry_run_commit (int argc , const char * * argv , const char * prefix ,
1187
1190
const struct commit * current_head , struct wt_status * s )
1188
1191
{
1189
- int commitable ;
1192
+ int committable ;
1190
1193
const char * index_file ;
1191
1194
1192
1195
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 );
1194
1197
rollback_index_files ();
1195
1198
1196
- return commitable ? 0 : 1 ;
1199
+ return committable ? 0 : 1 ;
1197
1200
}
1198
1201
1199
1202
define_list_config_array_extra (color_status_slots , {"added" });
@@ -1295,6 +1298,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
1295
1298
static int no_renames = -1 ;
1296
1299
static const char * rename_score_arg = (const char * )-1 ;
1297
1300
static struct wt_status s ;
1301
+ struct wt_status_state state ;
1298
1302
int fd ;
1299
1303
struct object_id oid ;
1300
1304
static struct option builtin_status_options [] = {
@@ -1379,15 +1383,17 @@ int cmd_status(int argc, const char **argv, const char *prefix)
1379
1383
s .rename_score = parse_rename_score (& rename_score_arg );
1380
1384
}
1381
1385
1382
- wt_status_collect (& s );
1386
+ wt_status_get_state (& s , & state );
1387
+ wt_status_collect (& s , & state );
1383
1388
1384
1389
if (0 <= fd )
1385
1390
update_index_if_able (& the_index , & index_lock );
1386
1391
1387
1392
if (s .relative_paths )
1388
1393
s .prefix = prefix ;
1389
1394
1390
- wt_status_print (& s );
1395
+ wt_status_print (& s , & state );
1396
+ wt_status_clear_state (& state );
1391
1397
return 0 ;
1392
1398
}
1393
1399
0 commit comments