From 46077fa5d477a3e96e0bb96042a2a9fdc9c818cb Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Tue, 25 May 2010 16:52:03 +0200 Subject: [PATCH] Documentation+t5708: document and test status -s -b Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- Documentation/git-status.txt | 10 +++++++++- t/t7508-status.sh | 47 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt index 2d4bbfcaf4..fd0fe7cb56 100644 --- a/Documentation/git-status.txt +++ b/Documentation/git-status.txt @@ -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 ------------- diff --git a/t/t7508-status.sh b/t/t7508-status.sh index 008d5711b8..9e081073fb 100755 --- a/t/t7508-status.sh +++ b/t/t7508-status.sh @@ -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 <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 with color.status' ' + + git status -s -b | test_decode_color >output && + test_cmp expect output + +' + +cat >expect <<\EOF M dir1/modified A dir2/added ?? dir1/untracked @@ -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: -- 2.11.4.GIT