@@ -112,10 +112,11 @@ static const char *only_include_assumed;
112
112
static struct strbuf message = STRBUF_INIT ;
113
113
114
114
static enum {
115
+ STATUS_FORMAT_NONE = 0 ,
115
116
STATUS_FORMAT_LONG ,
116
117
STATUS_FORMAT_SHORT ,
117
118
STATUS_FORMAT_PORCELAIN
118
- } status_format = STATUS_FORMAT_LONG ;
119
+ } status_format ;
119
120
120
121
static int opt_parse_m (const struct option * opt , const char * arg , int unset )
121
122
{
@@ -454,6 +455,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
454
455
case STATUS_FORMAT_PORCELAIN :
455
456
wt_porcelain_print (s );
456
457
break ;
458
+ case STATUS_FORMAT_NONE :
457
459
case STATUS_FORMAT_LONG :
458
460
wt_status_print (s );
459
461
break ;
@@ -1058,9 +1060,13 @@ static int parse_and_validate_options(int argc, const char *argv[],
1058
1060
if (all && argc > 0 )
1059
1061
die (_ ("Paths with -a does not make sense." ));
1060
1062
1061
- if (s -> null_termination && status_format == STATUS_FORMAT_LONG )
1062
- status_format = STATUS_FORMAT_PORCELAIN ;
1063
- if (status_format != STATUS_FORMAT_LONG )
1063
+ if (s -> null_termination ) {
1064
+ if (status_format == STATUS_FORMAT_NONE )
1065
+ status_format = STATUS_FORMAT_PORCELAIN ;
1066
+ else if (status_format == STATUS_FORMAT_LONG )
1067
+ die (_ ("--long and -z are incompatible" ));
1068
+ }
1069
+ if (status_format != STATUS_FORMAT_NONE )
1064
1070
dry_run = 1 ;
1065
1071
1066
1072
return argc ;
@@ -1159,6 +1165,9 @@ int cmd_status(int argc, const char **argv, const char *prefix)
1159
1165
OPT_SET_INT (0 , "porcelain" , & status_format ,
1160
1166
N_ ("machine-readable output" ),
1161
1167
STATUS_FORMAT_PORCELAIN ),
1168
+ OPT_SET_INT (0 , "long" , & status_format ,
1169
+ N_ ("show status in long format (default)" ),
1170
+ STATUS_FORMAT_LONG ),
1162
1171
OPT_BOOLEAN ('z' , "null" , & s .null_termination ,
1163
1172
N_ ("terminate entries with NUL" )),
1164
1173
{ OPTION_STRING , 'u' , "untracked-files" , & untracked_files_arg ,
@@ -1186,8 +1195,12 @@ int cmd_status(int argc, const char **argv, const char *prefix)
1186
1195
builtin_status_usage , 0 );
1187
1196
finalize_colopts (& s .colopts , -1 );
1188
1197
1189
- if (s .null_termination && status_format == STATUS_FORMAT_LONG )
1190
- status_format = STATUS_FORMAT_PORCELAIN ;
1198
+ if (s .null_termination ) {
1199
+ if (status_format == STATUS_FORMAT_NONE )
1200
+ status_format = STATUS_FORMAT_PORCELAIN ;
1201
+ else if (status_format == STATUS_FORMAT_LONG )
1202
+ die (_ ("--long and -z are incompatible" ));
1203
+ }
1191
1204
1192
1205
handle_untracked_files_arg (& s );
1193
1206
if (show_ignored_in_status )
@@ -1216,6 +1229,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
1216
1229
case STATUS_FORMAT_PORCELAIN :
1217
1230
wt_porcelain_print (& s );
1218
1231
break ;
1232
+ case STATUS_FORMAT_NONE :
1219
1233
case STATUS_FORMAT_LONG :
1220
1234
s .verbose = verbose ;
1221
1235
s .ignore_submodule_arg = ignore_submodule_arg ;
@@ -1386,6 +1400,9 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1386
1400
OPT_BOOLEAN (0 , "branch" , & s .show_branch , N_ ("show branch information" )),
1387
1401
OPT_SET_INT (0 , "porcelain" , & status_format ,
1388
1402
N_ ("machine-readable output" ), STATUS_FORMAT_PORCELAIN ),
1403
+ OPT_SET_INT (0 , "long" , & status_format ,
1404
+ N_ ("show status in long format (default)" ),
1405
+ STATUS_FORMAT_LONG ),
1389
1406
OPT_BOOLEAN ('z' , "null" , & s .null_termination ,
1390
1407
N_ ("terminate entries with NUL" )),
1391
1408
OPT_BOOLEAN (0 , "amend" , & amend , N_ ("amend previous commit" )),
0 commit comments