File tree Expand file tree Collapse file tree 2 files changed +55
-2
lines changed Expand file tree Collapse file tree 2 files changed +55
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ OPTIONS
27
27
--short::
28
28
Give the output in the short-format.
29
29
30
+ -b::
31
+ --branch::
32
+ Show the branch and tracking info even in short-format.
33
+
30
34
--porcelain::
31
35
Give the output in a stable, easy-to-parse format for scripts.
32
36
Currently this is identical to --short output, but is guaranteed
@@ -120,6 +124,10 @@ Ignored files are not listed.
120
124
? ? untracked
121
125
-------------------------------------------------
122
126
127
+ If -b is used the short-format status is preceded by a line
128
+
129
+ ## branchname tracking info
130
+
123
131
There is an alternate -z format recommended for machine parsing. In
124
132
that format, the status field is the same, but some other things
125
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
128
136
and the terminating newline (but a space still separates the status
129
137
field from the first filename). Third, filenames containing special
130
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.
132
140
133
141
CONFIGURATION
134
142
-------------
Original file line number Diff line number Diff line change @@ -107,13 +107,32 @@ A dir2/added
107
107
?? untracked
108
108
EOF
109
109
110
- test_expect_success ' status -s (2) ' '
110
+ test_expect_success ' status -s' '
111
111
112
112
git status -s >output &&
113
113
test_cmp expect output
114
114
115
115
'
116
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
+
117
136
cat > expect << EOF
118
137
# On branch master
119
138
# Changes to be committed:
@@ -436,6 +455,25 @@ test_expect_success 'status -s with color.status' '
436
455
437
456
'
438
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
+
439
477
cat > expect << \EOF
440
478
M dir1/modified
441
479
A dir2/added
@@ -469,6 +507,13 @@ test_expect_success 'status --porcelain ignores color.status' '
469
507
git config --unset color.status
470
508
git config --unset color.ui
471
509
510
+ test_expect_success ' status --porcelain ignores -b' '
511
+
512
+ git status --porcelain -b >output &&
513
+ test_cmp expect output
514
+
515
+ '
516
+
472
517
cat > expect << \EOF
473
518
# On branch master
474
519
# Changes to be committed:
You can’t perform that action at this time.
0 commit comments