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

[PATCH v1] convert: add test to demonstrate clean invocations

From
larsxschneider@gmail.com <larsxschneider@gmail.com>
Date
Jul 21, 2016, 20:59 UTC
Message-ID
<1469134747-26785-1-git-send-email-larsxschneider@gmail.com>
From: Lars Schneider <larsxschneider@gmail.com>

If three files processed by a filter are added and committed to a repository then I expect three clean invocations per Git operation. Apparently Git invokes the clean process 12 times.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---

It's pretty late here and I hope do not miss something obvious... but can anyone explain to me why the clean operation is executed 12 times for 3 files?

Thanks, Lars

 t/t0021-conversion.sh | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 7bac2bc..ab3d299 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -12,6 +12,12 @@ tr \
 EOF
 chmod +x rot13.sh

+cat <<EOF >run.sh
+#!$SHELL_PATH
+	echo "." >> run.count
+EOF
+chmod +x run.sh
+
 test_expect_success setup '
 	git config filter.rot13.smudge ./rot13.sh &&
 	git config filter.rot13.clean ./rot13.sh &&
@@ -268,4 +274,28 @@ test_expect_success 'disable filter with empty override' '
 	test_must_be_empty err
 '

+test_expect_failure 'required clean filter count' '
+	test_config_global filter.run_count.clean ./../run.sh &&
+	test_config_global filter.run_count.required true &&
+	rm -rf repo &&
+	mkdir repo &&
+	(
+		cd repo &&
+		git init &&
+
+		echo "*.r filter=run_count" >.gitattributes &&
+
+		cat ../test.o >test.r &&
+		echo "test22" >test2.r &&
+		echo "test333" >test3.r &&
+
+		rm -f run.count &&
+		git add . &&
+		test_line_count = 3 run.count
+
+		rm -f run.count &&
+		git commit . -m "test commit" &&
+		test_line_count = 3 run.count
+	)
+'
 test_done
--
2.5.1
Next: Jeff King
Message 1 of 6 in “convert: add test to demonstrate clean invocations”
  1. convert: add test to demonstrate clean invocationslarsxschneider@gmail.com, Jul 21, 2016
  2. Jeff KingJul 21, 2016
  3. diff: do not reuse worktree files that need "clean" conversionJeff King, Jul 22, 2016
  4. Junio C HamanoJul 22, 2016
  5. Jeff KingJul 22, 2016
  6. Junio C HamanoJul 22, 2016

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.