Skip to content

Commit

Permalink
Documentation+t5708: document and test status -s -b
Browse files Browse the repository at this point in the history
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael J Gruber authored and Junio C Hamano committed Jun 3, 2010
1 parent 05a59a0 commit 46077fa
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Documentation/git-status.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ OPTIONS
--short::
Give the output in the short-format.

-b::
--branch::
Show the branch and tracking info even in short-format.

--porcelain::
Give the output in a stable, easy-to-parse format for scripts.
Currently this is identical to --short output, but is guaranteed
Expand Down Expand Up @@ -120,6 +124,10 @@ Ignored files are not listed.
? ? untracked
-------------------------------------------------

If -b is used the short-format status is preceded by a line

## branchname tracking info

There is an alternate -z format recommended for machine parsing. In
that format, the status field is the same, but some other things
change. First, the '->' is omitted from rename entries and the field
Expand All @@ -128,7 +136,7 @@ order is reversed (e.g 'from -> to' becomes 'to from'). Second, a NUL
and the terminating newline (but a space still separates the status
field from the first filename). Third, filenames containing special
characters are not specially formatted; no quoting or
backslash-escaping is performed.
backslash-escaping is performed. Fourth, there is no branch line.

CONFIGURATION
-------------
Expand Down
47 changes: 46 additions & 1 deletion t/t7508-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,32 @@ A dir2/added
?? untracked
EOF

test_expect_success 'status -s (2)' '
test_expect_success 'status -s' '
git status -s >output &&
test_cmp expect output
'

cat >expect <<\EOF
## master
M dir1/modified
A dir2/added
?? dir1/untracked
?? dir2/modified
?? dir2/untracked
?? expect
?? output
?? untracked
EOF

test_expect_success 'status -s -b' '
git status -s -b >output &&
test_cmp expect output
'

cat >expect <<EOF
# On branch master
# Changes to be committed:
Expand Down Expand Up @@ -436,6 +455,25 @@ test_expect_success 'status -s with color.status' '
'

cat >expect <<\EOF
## <GREEN>master<RESET>
<RED>M<RESET> dir1/modified
<GREEN>A<RESET> dir2/added
<BLUE>??<RESET> dir1/untracked
<BLUE>??<RESET> dir2/modified
<BLUE>??<RESET> dir2/untracked
<BLUE>??<RESET> expect
<BLUE>??<RESET> output
<BLUE>??<RESET> untracked
EOF

test_expect_success 'status -s -b with color.status' '
git status -s -b | test_decode_color >output &&
test_cmp expect output
'

cat >expect <<\EOF
M dir1/modified
A dir2/added
Expand Down Expand Up @@ -469,6 +507,13 @@ test_expect_success 'status --porcelain ignores color.status' '
git config --unset color.status
git config --unset color.ui

test_expect_success 'status --porcelain ignores -b' '
git status --porcelain -b >output &&
test_cmp expect output
'

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

0 comments on commit 46077fa

Please sign in to comment.