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>
Michael J Gruber committed
May 25, 2010 at 16:52 UTC
46077fa5d477a3e96e0bb96042a2a9fdc9c818cb
2 files changed
+55
-2
Documentation/git-status.txt
+9
-1
@@ -27,6 +27,10 @@ OPTIONS
27
--short::
28
Give the output in the short-format.
29
30
+-b::
31
+--branch::
32
+ Show the branch and tracking info even in short-format.
33
+
34
--porcelain::
35
Give the output in a stable, easy-to-parse format for scripts.
36
Currently this is identical to --short output, but is guaranteed
@@ -120,6 +124,10 @@ Ignored files are not listed.
124
? ? untracked
125
-------------------------------------------------
126
127
+If -b is used the short-format status is preceded by a line
128
+
129
+## branchname tracking info
130
+
131
There is an alternate -z format recommended for machine parsing. In
132
that format, the status field is the same, but some other things
133
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
136
and the terminating newline (but a space still separates the status
137
field from the first filename). Third, filenames containing special
138
characters are not specially formatted; no quoting or
131
-backslash-escaping is performed.
139
+backslash-escaping is performed. Fourth, there is no branch line.
140
141
CONFIGURATION
142
-------------
t/t7508-status.sh
+46
-1
@@ -107,13 +107,32 @@ A dir2/added
107
?? untracked
108
EOF
109
110
-test_expect_success 'status -s (2)' '
110
+test_expect_success 'status -s' '
111
112
git status -s >output &&
113
test_cmp expect output
114
115
'
116
117
+cat >expect <<\EOF
118
+## master
119
+ M dir1/modified
120
+A dir2/added
121
+?? dir1/untracked
122
+?? dir2/modified
123
+?? dir2/untracked
124
+?? expect
125
+?? output
126
+?? untracked
127
+EOF
128
+
129
+test_expect_success 'status -s -b' '
130
+
131
+ git status -s -b >output &&
132
+ test_cmp expect output
133
+
134
+'
135
+
136
cat >expect <<EOF
137
# On branch master
138
# Changes to be committed:
@@ -436,6 +455,25 @@ test_expect_success 'status -s with color.status' '
455
456
'
457
458
+cat >expect <<\EOF
459
+## <GREEN>master<RESET>
460
+ <RED>M<RESET> dir1/modified
461
+<GREEN>A<RESET> dir2/added
462
+<BLUE>??<RESET> dir1/untracked
463
+<BLUE>??<RESET> dir2/modified
464
+<BLUE>??<RESET> dir2/untracked
465
+<BLUE>??<RESET> expect
466
+<BLUE>??<RESET> output
467
+<BLUE>??<RESET> untracked
468
+EOF
469
+
470
+test_expect_success 'status -s -b with color.status' '
471
+
472
+ git status -s -b | test_decode_color >output &&
473
+ test_cmp expect output
474
+
475
+'
476
+
477
cat >expect <<\EOF
478
M dir1/modified
479
A dir2/added
@@ -469,6 +507,13 @@ test_expect_success 'status --porcelain ignores color.status' '
507
git config --unset color.status
508
git config --unset color.ui
509
510
+test_expect_success 'status --porcelain ignores -b' '
511
+
512
+ git status --porcelain -b >output &&
513
+ test_cmp expect output
514
+
515
+'
516
+
517
cat >expect <<\EOF
518
# On branch master
519
# Changes to be committed: