mirror of
https://github.com/git/git
synced 2024-08-25 02:35:46 +00:00
Documentation+t5708: document and test status -s -b
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
05a59a087c
commit
46077fa5d4
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
-------------
|
||||
|
|
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue