Re: git status --ignored

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

 



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