@@ -991,12 +991,16 @@ static void short_print(struct wt_status *s, int null_termination)
991
991
int cmd_status (int argc , const char * * argv , const char * prefix )
992
992
{
993
993
struct wt_status s ;
994
- static int null_termination , shortstatus ;
994
+ static int null_termination ;
995
+ static enum {
996
+ STATUS_FORMAT_LONG ,
997
+ STATUS_FORMAT_SHORT ,
998
+ } status_format = STATUS_FORMAT_LONG ;
995
999
unsigned char sha1 [20 ];
996
1000
static struct option builtin_status_options [] = {
997
1001
OPT__VERBOSE (& verbose ),
998
- OPT_BOOLEAN ('s' , "short" , & shortstatus ,
999
- "show status concisely" ),
1002
+ OPT_SET_INT ('s' , "short" , & status_format ,
1003
+ "show status concisely" , STATUS_FORMAT_SHORT ),
1000
1004
OPT_BOOLEAN ('z' , "null" , & null_termination ,
1001
1005
"terminate entries with NUL" ),
1002
1006
{ OPTION_STRING , 'u' , "untracked-files" , & untracked_files_arg ,
@@ -1006,8 +1010,8 @@ int cmd_status(int argc, const char **argv, const char *prefix)
1006
1010
OPT_END (),
1007
1011
};
1008
1012
1009
- if (null_termination )
1010
- shortstatus = 1 ;
1013
+ if (null_termination && status_format == STATUS_FORMAT_LONG )
1014
+ status_format = STATUS_FORMAT_SHORT ;
1011
1015
1012
1016
wt_status_prepare (& s );
1013
1017
git_config (git_status_config , & s );
@@ -1024,9 +1028,11 @@ int cmd_status(int argc, const char **argv, const char *prefix)
1024
1028
s .is_initial = get_sha1 (s .reference , sha1 ) ? 1 : 0 ;
1025
1029
wt_status_collect (& s );
1026
1030
1027
- if (shortstatus )
1031
+ switch (status_format ) {
1032
+ case STATUS_FORMAT_SHORT :
1028
1033
short_print (& s , null_termination );
1029
- else {
1034
+ break ;
1035
+ case STATUS_FORMAT_LONG :
1030
1036
s .verbose = verbose ;
1031
1037
if (s .relative_paths )
1032
1038
s .prefix = prefix ;
@@ -1035,6 +1041,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
1035
1041
if (diff_use_color_default == -1 )
1036
1042
diff_use_color_default = git_use_color_default ;
1037
1043
wt_status_print (& s );
1044
+ break ;
1038
1045
}
1039
1046
return 0 ;
1040
1047
}
0 commit comments