Skip to contentSkip to conversation

t5310-pack-bitmaps: make JGit tests work with GIT_TEST_SPLIT_INDEX

PATCH In review SZEDER Gábor 2 participants 3 messages May 10, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t5310-pack-bitmaps: make JGit tests work with GIT_TEST_SPLIT_INDEX

The two JGit tests 'we can read jgit bitmaps' and 'jgit can read our bitmaps' in 't5310-pack-bitmaps.sh' fail when run with GIT_TEST_SPLIT_INDEX=YesPlease. Both tests create a clone of the test repository to check bitmap interoperability with JGit. With split indexes enabled the index in the clone repositories contains the 'link' extension, which JGit doesn't support and, consequently, an exception aborts it:

<...>
org.eclipse.jgit.api.errors.JGitInternalException: DIRC extension 'link' not supported by this version.
at org.eclipse.jgit.dircache.DirCache.readFrom(DirCache.java:562)
<...>

Since testing bitmaps doesn't need a worktree in the first place, let's just create bare clones for the two JGit tests, so the cloned won't have an index, and these two tests can be executed even with split index enabled.

---
 t/t5310-pack-bitmaps.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
t/t5310-pack-bitmaps.sh +4 -4
index f6d600fd82..423c0a475f 100755
@@ -264,9 +264,9 @@ test_expect_success 'pack with missing parent' '
 '
 
 test_expect_success JGIT 'we can read jgit bitmaps' '
-	git clone . compat-jgit &&
+	git clone --bare . compat-jgit.git &&
 	(
-		cd compat-jgit &&
+		cd compat-jgit.git &&
 		rm -f .git/objects/pack/*.bitmap &&
 		jgit gc &&
 		git rev-list --test-bitmap HEAD
@@ -274,9 +274,9 @@ test_expect_success JGIT 'we can read jgit bitmaps' '
 '
 
 test_expect_success JGIT 'jgit can read our bitmaps' '
-	git clone . compat-us &&
+	git clone --bare . compat-us.git &&
 	(
-		cd compat-us &&
+		cd compat-us.git &&
 		git repack -adb &&
 		# jgit gc will barf if it does not like our bitmaps
 		jgit gc
Signature · 1 line
2.17.0.756.gcf614c5aff
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · SZEDER Gábor

The two JGit tests 'we can read jgit bitmaps' and 'jgit can read our bitmaps' in 't5310-pack-bitmaps.sh' fail when run with GIT_TEST_SPLIT_INDEX=YesPlease. Both tests create a clone of the test repository to check bitmap interoperability with JGit. With split indexes enabled the index in the clone repositories contains the 'link' extension, which JGit doesn't support and, consequently, an exception aborts it:

<...>
org.eclipse.jgit.api.errors.JGitInternalException: DIRC extension 'link' not supported by this version.
at org.eclipse.jgit.dircache.DirCache.readFrom(DirCache.java:562)
<...>

Quoted 4 lines

Since testing bitmaps doesn't need a worktree in the first place, let's just create bare clones for the two JGit tests, so the cloned won't have an index, and these two tests can be executed even with split index enabled.

Nice, this seems like a clever workaround.

The more heavy-handed approach would be to just disable the JGIT prereq when GIT_TEST_SPLIT_INDEX is in use, which would cover this and potentially any other cases. This is nicer because it lets us continue using the test. And it's not like we have a ton of jgit dependencies, such that dealing with each individually would be a burden.

-Peff

#2 lore raw
Quoted 8 lines · Jeff King
Quoted 4 lines · SZEDER Gábor

Since testing bitmaps doesn't need a worktree in the first place, let's just create bare clones for the two JGit tests, so the cloned won't have an index, and these two tests can be executed even with split index enabled.

Nice, this seems like a clever workaround.

Quoted 7 lines

The more heavy-handed approach would be to just disable the JGIT prereq when GIT_TEST_SPLIT_INDEX is in use, which would cover this and potentially any other cases. This is nicer because it lets us continue using the test. And it's not like we have a ton of jgit dependencies, such that dealing with each individually would be a burden.

We could also 'sane_unset GIT_TEST_SPLIT_INDEX' in these two tests, but I think that we should do that only in tests that specifically check split index behavior (i.e. t1700).