builtin/commit.c: set status_format _after_ option parsing
'git status' should use --porcelain output format when -z is given. It was not doing so since the _effect_ of using -z, namely that null_termination would be set, was being checked _before_ option parsing was performed. So, move the check so that it is performed after option parsing. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Casey committed
May 26, 2011 at 13:43 UTC
000f97bd11e94fa8ede7fcdb43f5633997fed672
2 files changed
+5
-4
builtin-commit.c
+4
-3
@@ -1039,14 +1039,15 @@ int cmd_status(int argc, const char **argv, const char *prefix)
1039
OPT_END(),
1040
};
1041
1042
- if (null_termination && status_format == STATUS_FORMAT_LONG)
1043
- status_format = STATUS_FORMAT_PORCELAIN;
1044
-
1042
wt_status_prepare(&s);
1043
git_config(git_status_config, &s);
1044
argc = parse_options(argc, argv, prefix,
1045
builtin_status_options,
1046
builtin_status_usage, 0);
1047
+
1048
+ if (null_termination && status_format == STATUS_FORMAT_LONG)
1049
+ status_format = STATUS_FORMAT_PORCELAIN;
1050
+
1051
handle_untracked_files_arg(&s);
1052
1053
if (*argv)
t/t7508-status.sh
+1
-1
@@ -364,7 +364,7 @@ test_expect_success 'status submodule summary (clean submodule)' '
364
test_cmp expect output
365
'
366
367
-test_expect_failure 'status -z implies porcelain' '
367
+test_expect_success 'status -z implies porcelain' '
368
git status --porcelain |
369
perl -pe "s/\012/\000/g" >expect &&
370
git status -z >output &&