Skip to content

Commit

Permalink
Merge branch 'bc/maint-status-z-to-use-porcelain'
Browse files Browse the repository at this point in the history
* bc/maint-status-z-to-use-porcelain:
  builtin/commit.c: set status_format _after_ option parsing
  t7508: demonstrate status's failure to use --porcelain format with -z

Conflicts:
	builtin/commit.c
  • Loading branch information
Junio C Hamano committed Jun 6, 2011
2 parents a6605d7 + 000f97b commit 6c92972
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 4 additions & 3 deletions builtin/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1207,16 +1207,17 @@ int cmd_status(int argc, const char **argv, const char *prefix)
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(builtin_status_usage, builtin_status_options);

if (null_termination && status_format == STATUS_FORMAT_LONG)
status_format = STATUS_FORMAT_PORCELAIN;

wt_status_prepare(&s);
gitmodules_config();
git_config(git_status_config, &s);
determine_whence(&s);
argc = parse_options(argc, argv, prefix,
builtin_status_options,
builtin_status_usage, 0);

if (null_termination && status_format == STATUS_FORMAT_LONG)
status_format = STATUS_FORMAT_PORCELAIN;

handle_untracked_files_arg(&s);
if (show_ignored_in_status)
s.show_ignored_files = 1;
Expand Down
7 changes: 7 additions & 0 deletions t/t7508-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,13 @@ test_expect_success 'status -s submodule summary (clean submodule)' '
test_cmp expect output
'

test_expect_success 'status -z implies porcelain' '
git status --porcelain |
perl -pe "s/\012/\000/g" >expect &&
git status -z >output &&
test_cmp expect output
'

cat >expect <<EOF
# On branch master
# Changes to be committed:
Expand Down

0 comments on commit 6c92972

Please sign in to comment.