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

Re: [PATCH] t/t7700-repack.sh: fix test breakages with `GIT_TEST_MULTI_PACK_INDEX=1`

From
Jeff King <peff@peff.net>
Date
Apr 2, 2024, 20:24 UTC
Message-ID
<20240402202405.GC875182@coredump.intra.peff.net>
In-Reply-To
<ZgxSSKGdAicfVhGA@nand.local>
On Tue, Apr 02, 2024 at 02:45:28PM -0400, Taylor Blau wrote:
Show 11 quoted lines
> I have generally considered the `--write-midx` and
> `GIT_TEST_MULTI_PACK_INDEX` options to be orthogonal to each other. The
> latter is a developer-oriented option that forces Git to write a MIDX
> post-repack regardless of the command-line option.
> 
> It predates the `--write-midx` option by a number of years, and IIUC was
> introduced to enhance test coverage while the MIDX was being originally
> developed.
> 
> I would argue that GIT_TEST_MULTI_PACK_INDEX should be on the list of
> GIT_TEST_-variables to get rid of as it has served its purpose.

Hmm. Obviously it is of little value in this explicit --write-midx test, but I thought the main value was just exercising all of the _other_ tests with a midx in place. Doesn't that potentially have value (just like testing with SPLIT_INDEX, etc, gets more coverage)?

If it is worth keeping (and I do not really have a strong opinion there), the real issue seems to me that it does not behave like --write-midx. That is the source of the problem here, but also makes test runs with it unrealistic, since the command-line option is how real-world users would trigger it.

I.e., I would have expected something like this, so that the variables takes precedence over config but under command-line options:

diff --git a/builtin/repack.c b/builtin/repack.c
index 15e4cccc45..4b02d9cb77 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -1197,6 +1197,11 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 
 	git_config(repack_config, &cruft_po_args);
 
+	write_midx = git_env_bool(GIT_TEST_MULTI_PACK_INDEX, write_midx);
+	if (write_midx)
+		write_bitmaps = git_env_bool(GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP,
+					     write_bitmaps);
+
 	argc = parse_options(argc, argv, prefix, builtin_repack_options,
 				git_repack_usage, 0);
 
@@ -1214,10 +1219,6 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 		if (!write_midx &&
 		    (!(pack_everything & ALL_INTO_ONE) || !is_bare_repository()))
 			write_bitmaps = 0;
-	} else if (write_bitmaps &&
-		   git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0) &&
-		   git_env_bool(GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP, 0)) {
-		write_bitmaps = 0;
 	}
 	if (pack_kept_objects < 0)
 		pack_kept_objects = write_bitmaps > 0 && !write_midx;
@@ -1515,13 +1516,6 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 	if (run_update_server_info)
 		update_server_info(0);
 
-	if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0)) {
-		unsigned flags = 0;
-		if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP, 0))
-			flags |= MIDX_WRITE_BITMAP | MIDX_WRITE_REV_INDEX;
-		write_midx_file(get_object_directory(), NULL, NULL, flags);
-	}
-
 cleanup:
 	string_list_clear(&names, 1);
 	existing_packs_release(&existing);

But it gets weird because some tests (like t7700.2) explicitly ask for
bitmaps on the command line and want pack bitmaps but _not_ midx
bitmaps.

So I dunno. Maybe this is a can of worms that is not worth falling into.
After all, these are not "real" environment variables that we expect
users to use. I just wonder if the ci runs with them are buying us
anything for all of the tests outside of t7700.

-Peff
Previous: Taylor BlauNext: Junio C Hamano
Message 6 of 7 in “t/t7700-repack.sh: fix test breakages with `GIT_TEST_MULTI_PACK_INDEX=1`”
  1. t/t7700-repack.sh: fix test breakages with `GIT_TEST_MULTI_PACK_INDEX=1`Taylor Blau, Apr 2, 2024
  2. Junio C HamanoApr 2, 2024
  3. Taylor BlauApr 2, 2024
  4. Junio C HamanoApr 2, 2024
  5. Taylor BlauApr 2, 2024
  6. Jeff KingApr 2, 2024
  7. Junio C HamanoApr 2, 2024

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.