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

[PATCH 05/20] t9300: make the series V tests self-contained

From
Karthik Nayak <karthik.188@gmail.com>
Date
Nov 10, 2026, 11:49 UTC
Message-ID
<20261110-kn-fast-import-tests-1-v1-5-dbd9ee502aae@gmail.com>
In-Reply-To
<20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com>

Similar to the previous commits, modify the tests in 'series V' to make them independent of state from previous tests.

Move the setup to a 'setup_checkpoint_repo()' function, so each test can invoke it. The tests used to build on the 'U' branch from series U, so let the function create a 'base' commit instead. For the same reason, the tag test now tags 'base' and not 'V'.

'background_import_then_checkpoint()' registers a cleanup with 'test_when_finished', which is not allowed in a subshell, so call it from the main shell.

The 'no new objects' test needs the 'V' commit in a pack, because fast-import only detects duplicates against packs and not against loose objects. It used to rely on the 'fastimport.unpackLimit' set by an earlier test, so create the commit in the test with 'fastimport.unpackLimit' set to 0.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
 t/t9300-fast-import.sh | 80 ++++++++++++++++++++++++++++++++++----------------
 1 file changed, 55 insertions(+), 25 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 14af91cffd..8124983409 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -3777,7 +3777,7 @@ background_import_then_checkpoint () {
 	rm V.output
 
 	(
-		git fast-import $options <&8 >&9 &
+		git -C repo fast-import $options <&8 >&9 &
 		echo $! >&9
 		wait $!
 		echo >&2 "background fast-import terminated too early with exit code $?"
@@ -3829,80 +3829,110 @@ background_import_still_running () {
 	fi
 }
 
+setup_checkpoint_repo () {
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	test_tick &&
+	git -C repo fast-import <<-INPUT_END
+	commit refs/heads/base
+	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+	data <<COMMIT
+	base commit
+	COMMIT
+	INPUT_END
+}
+
 test_expect_success PIPE 'V: checkpoint helper does not get stuck with extra output' '
-	cat >input <<-INPUT_END &&
+	setup_checkpoint_repo &&
+	cat >repo/input <<-INPUT_END &&
 	progress foo
 	progress bar
 
 	INPUT_END
 
-	background_import_then_checkpoint "" input &&
+	background_import_then_checkpoint "" repo/input &&
 	background_import_still_running
 '
 
 test_expect_success PIPE 'V: checkpoint updates refs after reset' '
-	cat >input <<-\INPUT_END &&
+	setup_checkpoint_repo &&
+	cat >repo/input <<-\INPUT_END &&
 	reset refs/heads/V
-	from refs/heads/U
+	from refs/heads/base
 
 	INPUT_END
 
-	background_import_then_checkpoint "" input &&
-	test "$(git rev-parse --verify V)" = "$(git rev-parse --verify U)" &&
+	background_import_then_checkpoint "" repo/input &&
+	test "$(git -C repo rev-parse --verify V)" = "$(git -C repo rev-parse --verify base)" &&
 	background_import_still_running
 '
 
 test_expect_success PIPE 'V: checkpoint updates refs and marks after commit' '
-	cat >input <<-INPUT_END &&
+	setup_checkpoint_repo &&
+	cat >repo/input <<-INPUT_END &&
 	commit refs/heads/V
 	mark :1
 	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 	data 0
-	from refs/heads/U
+	from refs/heads/base
 
 	INPUT_END
 
-	background_import_then_checkpoint "--export-marks=marks.actual" input &&
+	background_import_then_checkpoint "--export-marks=marks.actual" repo/input &&
+	(
+		cd repo &&
+		echo ":1 $(git rev-parse --verify V)" >marks.expected &&
 
-	echo ":1 $(git rev-parse --verify V)" >marks.expected &&
-
-	test "$(git rev-parse --verify V^)" = "$(git rev-parse --verify U)" &&
-	test_cmp marks.expected marks.actual &&
+		test "$(git rev-parse --verify V^)" = "$(git rev-parse --verify base)" &&
+		test_cmp marks.expected marks.actual
+	) &&
 	background_import_still_running
 '
 
 # Re-create the exact same commit, but on a different branch: no new object is
 # created in the database, but the refs and marks still need to be updated.
 test_expect_success PIPE 'V: checkpoint updates refs and marks after commit (no new objects)' '
-	cat >input <<-INPUT_END &&
+	setup_checkpoint_repo &&
+	git -C repo -c fastimport.unpackLimit=0 fast-import <<-INPUT_END &&
+	commit refs/heads/V
+	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+	data 0
+	from refs/heads/base
+
+	INPUT_END
+
+	cat >repo/input <<-INPUT_END &&
 	commit refs/heads/V2
 	mark :2
 	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 	data 0
-	from refs/heads/U
+	from refs/heads/base
 
 	INPUT_END
 
-	background_import_then_checkpoint "--export-marks=marks.actual" input &&
+	background_import_then_checkpoint "--export-marks=marks.actual" repo/input &&
+	(
+		cd repo &&
+		echo ":2 $(git rev-parse --verify V2)" >marks.expected &&
 
-	echo ":2 $(git rev-parse --verify V2)" >marks.expected &&
-
-	test "$(git rev-parse --verify V2)" = "$(git rev-parse --verify V)" &&
-	test_cmp marks.expected marks.actual &&
+		test "$(git rev-parse --verify V2)" = "$(git rev-parse --verify V)" &&
+		test_cmp marks.expected marks.actual
+	) &&
 	background_import_still_running
 '
 
 test_expect_success PIPE 'V: checkpoint updates tags after tag' '
-	cat >input <<-INPUT_END &&
+	setup_checkpoint_repo &&
+	cat >repo/input <<-INPUT_END &&
 	tag Vtag
-	from refs/heads/V
+	from refs/heads/base
 	tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 	data 0
 
 	INPUT_END
 
-	background_import_then_checkpoint "" input &&
-	git show-ref -d Vtag &&
+	background_import_then_checkpoint "" repo/input &&
+	git -C repo show-ref -d Vtag &&
 	background_import_still_running
 '
 
-- 
2.56.GIT
Previous: Karthik NayakNext: Karthik Nayak
Message 6 of 45 in “t9300: group and move tests to other files”
  1. 00/20 t9300: group and move tests to other filesKarthik Nayak, Nov 10, 2026
  2. 01/20 t9300: move 'fastimport.unpackLimit' to the required testKarthik Nayak, Nov 10, 2026
  3. 02/20 t9300: make the series B tests self-containedKarthik Nayak, Nov 10, 2026
  4. 03/20 t9300: make the series T tests self-containedKarthik Nayak, Nov 10, 2026
  5. 04/20 t9300: make the series S tests self-containedKarthik Nayak, Nov 10, 2026
  6. 05/20 t9300: make the series V tests self-containedKarthik Nayak, Nov 10, 2026
  7. 06/20 t9300: make the series Q tests self-containedKarthik Nayak, Nov 10, 2026
  8. 07/20 t9300: make the series P tests self-containedKarthik Nayak, Nov 10, 2026
  9. 08/20 t9300: make the series O tests self-containedKarthik Nayak, Nov 10, 2026
  10. 09/20 t9300: make the big blob tests self-containedKarthik Nayak, Nov 10, 2026
  11. 10/20 t9300: make the ref update tests self-containedKarthik Nayak, Nov 10, 2026
  12. 11/20 t9300: make the date format tests self-containedKarthik Nayak, Nov 10, 2026
  13. 12/20 t9300: make the pack edges test self-containedKarthik Nayak, Nov 10, 2026
  14. 13/20 t9300: make the marks tests self-containedKarthik Nayak, Nov 10, 2026
  15. 14/20 t9300: make the series Y tests self-containedKarthik Nayak, Nov 10, 2026
  16. 15/20 t9300: make the cat-blob tests self-containedKarthik Nayak, Nov 10, 2026
  17. 16/20 t9300: make the feature and option tests self-containedKarthik Nayak, Nov 10, 2026
  18. 17/20 t9300: make the stream tests self-containedKarthik Nayak, Nov 10, 2026
  19. 18/20 t9300: make the get-mark and encoding tests self-containedKarthik Nayak, Nov 10, 2026
  20. 19/20 t9300: move self-contained tests into dedicated filesKarthik Nayak, Nov 10, 2026
  21. 20/20 t93xx: drop the series letter from the moved test namesKarthik Nayak, Nov 10, 2026
  22. Junio C HamanoNov 10, 2026
  23. Junio C HamanoNov 10, 2026
  24. Karthik NayakNov 11, 2026
  25. 00/20 t9300: group and move tests to other filesKarthik Nayak, Nov 12, 2026
  26. 01/20 t9300: move 'fastimport.unpackLimit' to the required testKarthik Nayak, Nov 12, 2026
  27. 02/20 t9300: make the series B tests self-containedKarthik Nayak, Nov 12, 2026
  28. 03/20 t9300: make the series T tests self-containedKarthik Nayak, Nov 12, 2026
  29. 04/20 t9300: make the series S tests self-containedKarthik Nayak, Nov 12, 2026
  30. 05/20 t9300: make the series V tests self-containedKarthik Nayak, Nov 12, 2026
  31. 06/20 t9300: make the series Q tests self-containedKarthik Nayak, Nov 12, 2026
  32. 07/20 t9300: make the series P tests self-containedKarthik Nayak, Nov 12, 2026
  33. 08/20 t9300: make the series O tests self-containedKarthik Nayak, Nov 12, 2026
  34. 09/20 t9300: make the big blob tests self-containedKarthik Nayak, Nov 12, 2026
  35. 10/20 t9300: make the ref update tests self-containedKarthik Nayak, Nov 12, 2026
  36. 11/20 t9300: make the date format tests self-containedKarthik Nayak, Nov 12, 2026
  37. 12/20 t9300: make the pack edges test self-containedKarthik Nayak, Nov 12, 2026
  38. 13/20 t9300: make the marks tests self-containedKarthik Nayak, Nov 12, 2026
  39. 14/20 t9300: make the series Y tests self-containedKarthik Nayak, Nov 12, 2026
  40. 15/20 t9300: make the cat-blob tests self-containedKarthik Nayak, Nov 12, 2026
  41. 16/20 t9300: make the feature and option tests self-containedKarthik Nayak, Nov 12, 2026
  42. 17/20 t9300: make the stream tests self-containedKarthik Nayak, Nov 12, 2026
  43. 18/20 t9300: make the get-mark and encoding tests self-containedKarthik Nayak, Nov 12, 2026
  44. 19/20 t9300: move self-contained tests into dedicated filesKarthik Nayak, Nov 12, 2026
  45. 20/20 t93xx: drop the series letter from the moved test namesKarthik Nayak, Nov 12, 2026

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.