git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] t0021: make sure clean filter runs

From
Thomas Gummerer <t.gummerer@gmail.com>
Date
Aug 22, 2019, 19:22 UTC
Message-ID
<20190822192240.GA4077@cat>
In-Reply-To
<20190820065625.128130-1-t.gummerer@gmail.com>

In t0021.15 one of the things we are checking is that the clean filter is run when checking out empty-branch. The clean filter needs to be run to make sure there are no modifications on the file system for the test.r file, and thus it isn't dangerous to overwrite it.

However in the current test setup it is not always necessary to run the clean filter, and thus the test sometimes fails, as debug.log isn't written.

This happens when test.r has an older mtime than the index itself. That mtime is also recorded as stat data for test.r in the index, and based on the heuristic we're using for index entries, git correctly assumes this file is up-to-date.

Usually this test succeeds because the mtime of test.r is the same as the mtime of the index. In this case test.r is racily clean, so git actually checks the contents, for which the clean filter is run.

Fix the test by updating the mtime of test.r, so git is forced to check the contents of the file, and the clean filter is run as the test expects.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
---
v2 adds the comment as suggested by Szeder.
Junio: I saw this is marked as "merged to 'next'" in the What's
cooking, so if it got merged already I'm fine with just keeping v1,
but otherwise I think adding the comment would be nice.
 t/t0021-conversion.sh | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index e10f5f787f..c954c709ad 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -390,6 +390,9 @@ test_expect_success PERL 'required process filter should filter data' '
 		EOF
 		test_cmp_exclude_clean expected.log debug.log &&
 
+		# Make sure that the file appears dirty, so checkout below has to
+		# run the configured filter.
+		touch test.r &&
 		filter_git checkout --quiet --no-progress empty-branch &&
 		cat >expected.log <<-EOF &&
 			START
-- 
2.23.0.rc2.194.ge5444969c9
Previous: Johannes SixtNext: Junio C Hamano
Message 12 of 14 in “t0021: make sure clean filter runs”
  1. t0021: make sure clean filter runsThomas Gummerer, Aug 20, 2019
  2. Junio C HamanoAug 20, 2019
  3. Thomas GummererAug 21, 2019
  4. Junio C HamanoAug 21, 2019
  5. Johannes SixtAug 20, 2019
  6. Thomas GummererAug 21, 2019
  7. Johannes SixtAug 21, 2019
  8. SZEDER GáborAug 21, 2019
  9. Thomas GummererAug 22, 2019
  10. Junio C HamanoAug 22, 2019
  11. Johannes SixtAug 22, 2019
  12. t0021: make sure clean filter runsThomas Gummerer, Aug 22, 2019
  13. Junio C HamanoAug 22, 2019
  14. SZEDER GáborAug 23, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.