git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Andrew Spiers <aspiers@vpac.org>, git@vger.kernel.org
Subject: Re: git status --ignored
Date: Thu, 2 Jun 2011 13:20:21 -0400	[thread overview]
Message-ID: <20110602172021.GB2928@sigill.intra.peff.net> (raw)
In-Reply-To: <7vk4d4dxn1.fsf@alter.siamese.dyndns.org>

On Thu, Jun 02, 2011 at 09:08:18AM -0700, Junio C Hamano wrote:

> +	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

Unfortunately this does not actually show the bug, as the short format
takes a different code path that was not broken.

I have mixed feelings about putting the whole long format in a test
vector, as all of the human-readable bits are supposed to be allowed to
change. And I know that tests are only partially about demonstrating a
particular bug, and more about codifying the behavior we want so future
changes don't break it. But it is nice to exercise that code path, and
it doesn't change all that much, so maybe it is worth doing. Squashable
patch below. Throw it out if you don't agree.

> +test_expect_success 'status with gitignore' '

It took me a minute to figure out what was different between the two
tests with the same title. Maybe calling them "status with gitignore
(untracked files present)" and "status with gitignore (no untracked
files)" would help future readers.

---
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index b47aad8..957c1e3 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -115,6 +115,36 @@ test_expect_success 'status with gitignore' '
 	EOF
 	git status -s --ignored >output &&
 	test_cmp expect output
+
+	cat >expect <<-\EOF &&
+	# On branch master
+	# Changes to be committed:
+	#   (use "git reset HEAD <file>..." to unstage)
+	#
+	#	new file:   dir2/added
+	#
+	# Changed but not updated:
+	#   (use "git add <file>..." to update what will be committed)
+	#   (use "git checkout -- <file>..." to discard changes in working directory)
+	#
+	#	modified:   dir1/modified
+	#
+	# Untracked files:
+	#   (use "git add <file>..." to include in what will be committed)
+	#
+	#	dir2/modified
+	# Ignored files:
+	#   (use "git add -f <file>..." to include in what will be committed)
+	#
+	#	.gitignore
+	#	dir1/untracked
+	#	dir2/untracked
+	#	expect
+	#	output
+	#	untracked
+	EOF
+	git status --ignored >output &&
+	test_cmp expect output
 '
 
 test_expect_success 'status with gitignore' '
@@ -146,6 +176,33 @@ test_expect_success 'status with gitignore' '
 	EOF
 	git status -s --ignored >output &&
 	test_cmp expect output
+
+	cat >expect <<-\EOF &&
+	# On branch master
+	# Changes to be committed:
+	#   (use "git reset HEAD <file>..." to unstage)
+	#
+	#	new file:   dir2/added
+	#
+	# Changed but not updated:
+	#   (use "git add <file>..." to update what will be committed)
+	#   (use "git checkout -- <file>..." to discard changes in working directory)
+	#
+	#	modified:   dir1/modified
+	#
+	# Ignored files:
+	#   (use "git add -f <file>..." to include in what will be committed)
+	#
+	#	.gitignore
+	#	dir1/untracked
+	#	dir2/modified
+	#	dir2/untracked
+	#	expect
+	#	output
+	#	untracked
+	EOF
+	git status --ignored >output &&
+	test_cmp expect output
 '
 
 rm -f .gitignore

  reply	other threads:[~2011-06-02 17:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02  4:34 git status --ignored Andrew Spiers
2011-06-02  5:13 ` Junio C Hamano
2011-06-02  5:54   ` Jeff King
2011-06-02  5:57     ` Jeff King
2011-06-02 16:08     ` Junio C Hamano
2011-06-02 17:20       ` Jeff King [this message]
2011-06-02 18:30         ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2011-06-02  4:43 Andrew Spiers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110602172021.GB2928@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=aspiers@vpac.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).