🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.git
1 messages
1 total messages Started by Karthik Nayak Thu, 12 Nov 2026 17:34
[PATCH v2 12/20] t9300: make the pack edges test self-contained
#2995
Author: Karthik Nayak
Date: Thu, 12 Nov 2026 17:34
130 lines
15754 bytes
Similar to the previous commits, modify the pack-edges tests to make
them independent of state from previous tests.

Pack edges are only recorded for packs which are kept, so set
'fastimport.unpackLimit' to 0 for the import.

Create the repository with 'git init -b main', as the import builds on
'main' and t9302, where this test ends up, doesn't set
'GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME'.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
 t/t9300-fast-import.sh | 90 +++++++++++++++++++++++++++++++-------------------
 1 file changed, 56 insertions(+), 34 deletions(-)

diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 54394c892b..5b8550584e 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -1030,50 +1030,72 @@ test_expect_success 'H: verify file' '
 ###
 
 test_expect_success 'I: export-pack-edges option forbidden by default' '
-	echo "option git export-pack-edges=edges.list" >input &&
-	test_must_fail git fast-import <input 2>err &&
-	test_grep "option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features" err
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+		echo "option git export-pack-edges=edges.list" >input &&
+		test_must_fail git fast-import <input 2>err &&
+		test_grep "option ${SQ}export-pack-edges${SQ} forbidden in input without --allow-unsafe-features" err
+	)
 '
 
 test_expect_success 'I: export-pack-edges' '
-	test_when_finished "rm edges.list" &&
-	cat >input <<-INPUT_END &&
-	commit refs/heads/export-boundary
-	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	we have a border.  its only 40 characters wide.
-	COMMIT
+	test_when_finished "rm -rf repo" &&
+	git init -b main repo &&
+	(
+		cd repo &&
+		test_commit one &&
 
-	from refs/heads/branch
+		cat >input <<-INPUT_END &&
+		commit refs/heads/export-boundary
+		committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		we have a border.  its only 40 characters wide.
+		COMMIT
 
-	INPUT_END
-	git fast-import --export-pack-edges=edges.list <input &&
-	cat >expect <<-EOF &&
-	.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)
-	EOF
-	sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
-	test_cmp expect actual
+		from refs/heads/main
+
+		INPUT_END
+		git -c fastimport.unpackLimit=0 fast-import \
+			--export-pack-edges=edges.list <input &&
+
+		# verify edge list
+		cat >expect <<-EOF &&
+		.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)
+		EOF
+		sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
+		test_cmp expect actual
+	)
 '
 
 test_expect_success 'I: export-pack-edges via stdin' '
-	test_when_finished "rm edges.list" &&
-	cat >input <<-INPUT_END &&
-	option git export-pack-edges=edges.list
-	commit refs/heads/export-boundary-2
-	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	one more similar commit
-	COMMIT
+	test_when_finished "rm -rf repo" &&
+	git init -b main repo &&
+	(
+		cd repo &&
+		test_commit one &&
 
-	from refs/heads/branch
+		cat >input <<-INPUT_END &&
+		option git export-pack-edges=edges.list
+		commit refs/heads/export-boundary
+		committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		one more similar commit
+		COMMIT
 
-	INPUT_END
-	git fast-import --allow-unsafe-features <input &&
-	cat >expect <<-EOF &&
-	.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary-2)
-	EOF
-	sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
-	test_cmp expect actual
+		from refs/heads/main
+
+		INPUT_END
+
+		git -c fastimport.unpackLimit=0 fast-import \
+			--allow-unsafe-features <input &&
+		cat >expect <<-EOF &&
+		.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)
+		EOF
+		sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
+		test_cmp expect actual
+	)
 '
 
 ###

-- 
2.56.GIT
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads