Re: [PATCH v6 10/12] fsmonitor: add test cases for fsmonitor extension

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

 





On 9/19/2017 3:32 PM, David Turner wrote:
I think my comment here might have gotten lost, and I don't want it to because it's something I'm really worried about:


You have to update the test completely to ensure it passes. If you run the test with the '-v' option you will see the cause of the failure:

t7519-status-fsmonitor.sh: line 27: dir3/untracked: No such file or directory

To fix this, you will also need to update the 'setup' test to create the directory for the new untracked file to get created into. Then you will need to drop at least one file in it so that the directory is preserved through the 'git reset --hard' Then you have to update the several 'cat >expect' blocks to expect the new file.

In addition, the ability to avoid scanning for untracked files relies on the untracked cache. If you don't have another file that git is aware of in that directory then there won't be a cache entry and git will do the required scan and detect the new untracked file (by design).

Here is a patch to the test that updates it to meet all these requirements. I hope this helps.


diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh
index c6df85af5e..29ae4e284f 100755
--- a/t/t7519-status-fsmonitor.sh
+++ b/t/t7519-status-fsmonitor.sh
@@ -24,12 +24,14 @@ dirty_repo () {
 	: >untracked &&
 	: >dir1/untracked &&
 	: >dir2/untracked &&
+	: >dir3/untracked &&
 	echo 1 >modified &&
 	echo 2 >dir1/modified &&
 	echo 3 >dir2/modified &&
 	echo 4 >new &&
 	echo 5 >dir1/new &&
 	echo 6 >dir2/new
+	echo 7 >dir3/new
 }

 write_integration_script () {
@@ -47,12 +49,14 @@ write_integration_script () {
 	printf "untracked\0"
 	printf "dir1/untracked\0"
 	printf "dir2/untracked\0"
+	printf "dir3/untracked\0"
 	printf "modified\0"
 	printf "dir1/modified\0"
 	printf "dir2/modified\0"
 	printf "new\0"
 	printf "dir1/new\0"
 	printf "dir2/new\0"
+	printf "dir3/new\0"
 	EOF
 }

@@ -71,6 +75,8 @@ test_expect_success 'setup' '
 	mkdir dir2 &&
 	: >dir2/tracked &&
 	: >dir2/modified &&
+	mkdir dir3 &&
+	: >dir3/tracked &&
 	git -c core.fsmonitor= add . &&
 	git -c core.fsmonitor= commit -m initial &&
 	git config core.fsmonitor .git/hooks/fsmonitor-test &&
@@ -107,6 +113,7 @@ h dir1/modified
 H dir1/tracked
 h dir2/modified
 H dir2/tracked
+H dir3/tracked
 h modified
 H tracked
 EOF
@@ -126,6 +133,7 @@ H dir1/modified
 H dir1/tracked
 H dir2/modified
 H dir2/tracked
+H dir3/tracked
 H modified
 H tracked
 EOF
@@ -144,6 +152,7 @@ H dir1/modified
 H dir1/tracked
 H dir2/modified
 H dir2/tracked
+H dir3/tracked
 H modified
 H tracked
 EOF
@@ -164,6 +173,8 @@ H dir1/tracked
 H dir2/modified
 h dir2/new
 H dir2/tracked
+h dir3/new
+H dir3/tracked
 H modified
 h new
 H tracked
@@ -174,6 +185,7 @@ test_expect_success 'newly added files are marked valid' '
 	git add new &&
 	git add dir1/new &&
 	git add dir2/new &&
+	git add dir3/new &&
 	git ls-files -f >actual &&
 	test_cmp expect actual
 '
@@ -185,6 +197,8 @@ h dir1/tracked
 H dir2/modified
 h dir2/new
 h dir2/tracked
+h dir3/new
+h dir3/tracked
 H modified
 h new
 h tracked
@@ -203,6 +217,7 @@ H dir1/modified
 h dir1/tracked
 h dir2/modified
 h dir2/tracked
+h dir3/tracked
 h modified
 h tracked
 EOF
@@ -269,6 +284,7 @@ do
 			git add new &&
 			git add dir1/new &&
 			git add dir2/new &&
+			git add dir3/new &&
 			git status >actual &&
 			git -c core.fsmonitor= status >expect &&
 			test_i18ncmp expect actual



-----Original Message-----
From: David Turner
Sent: Friday, September 15, 2017 6:00 PM
To: 'Ben Peart' <benpeart@xxxxxxxxxxxxx>
Cc: avarab@xxxxxxxxx; christian.couder@xxxxxxxxx; git@xxxxxxxxxxxxxxx;
gitster@xxxxxxxxx; johannes.schindelin@xxxxxx; pclouds@xxxxxxxxx;
peff@xxxxxxxx
Subject: RE: [PATCH v6 10/12] fsmonitor: add test cases for fsmonitor
extension

-----Original Message-----
+dirty_repo () {
+	: >untracked &&
+	: >dir1/untracked &&
+	: >dir2/untracked &&
+	echo 1 >modified &&
+	echo 2 >dir1/modified &&
+	echo 3 >dir2/modified &&
+	echo 4 >new &&
+	echo 5 >dir1/new &&
+	echo 6 >dir2/new

If I add an untracked file named dir3/untracked to dirty_repo  (and
write_integration_script), then "status doesn't detect unreported
modifications", below, fails.  Did I do something wrong, or does this turn up a
bug?





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

  Powered by Linux