Re: git status --ignored

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> I can reproduce here. The faulty logic means the bug only shows when you
> actually have no real untracked files. You should keep your git
> directory cleaner. ;)

Ok.

-- >8 --
Subject: [PATCH] git status --ignored: tests and docs

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---
 Documentation/git-status.txt |    6 ++++
 t/t7508-status.sh            |   64 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index 1cab91b..b663e51 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -49,6 +49,9 @@ See linkgit:git-config[1] for configuration variable
 used to change the default for when the option is not
 specified.
 
+--ignored::
+	Show ignored files as well.
+
 -z::
 	Terminate entries with NUL, instead of LF.  This implies
 	the `--porcelain` output format if no other format is given.
@@ -80,6 +83,8 @@ shows the status of stage #3 (i.e. theirs).
 For entries that do not have conflicts, `X` shows the status of the index,
 and `Y` shows the status of the work tree.  For untracked paths, `XY` are
 `??`.
+For ignored paths, `XY` are `!!`; they are shown only when the `--ignored`
+option is in effect.
 
     X          Y     Meaning
     -------------------------------------------------
@@ -102,6 +107,7 @@ and `Y` shows the status of the work tree.  For untracked paths, `XY` are
     U           U    unmerged, both modified
     -------------------------------------------------
     ?           ?    untracked
+    !           !    ignored
     -------------------------------------------------
 
 
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 556d0fa..b47aad8 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -86,6 +86,70 @@ test_expect_success 'status -s (2)' '
 
 '
 
+test_expect_success 'status with gitignore' '
+	{
+		echo ".gitignore" &&
+		echo "expect" &&
+		echo "output" &&
+		echo "untracked"
+	} >.gitignore &&
+
+	cat >expect <<-\EOF &&
+	 M dir1/modified
+	A  dir2/added
+	?? dir2/modified
+	EOF
+	git status -s >output &&
+	test_cmp expect output &&
+
+	cat >expect <<-\EOF &&
+	 M dir1/modified
+	A  dir2/added
+	?? dir2/modified
+	!! .gitignore
+	!! dir1/untracked
+	!! dir2/untracked
+	!! expect
+	!! output
+	!! untracked
+	EOF
+	git status -s --ignored >output &&
+	test_cmp expect output
+'
+
+test_expect_success 'status with gitignore' '
+	{
+		echo ".gitignore" &&
+		echo "expect" &&
+		echo "dir2/modified" &&
+		echo "output" &&
+		echo "untracked"
+	} >.gitignore &&
+
+	cat >expect <<-\EOF &&
+	 M dir1/modified
+	A  dir2/added
+	EOF
+	git status -s >output &&
+	test_cmp expect output &&
+
+	cat >expect <<-\EOF &&
+	 M dir1/modified
+	A  dir2/added
+	!! .gitignore
+	!! dir1/untracked
+	!! dir2/modified
+	!! dir2/untracked
+	!! expect
+	!! output
+	!! untracked
+	EOF
+	git status -s --ignored >output &&
+	test_cmp expect output
+'
+
+rm -f .gitignore
+
 cat >expect <<EOF
 # On branch master
 # Changes to be committed:
-- 
1.7.6.rc0.98.gc12085

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]