t: support GIT_TEST_WRITE_REV_INDEX

Add a new option that unconditionally enables the pack.writeReverseIndex setting in order to run the whole test suite in a mode that generates on-disk reverse indexes. Additionally, enable this mode in the second run of tests under linux-gcc in 'ci/run-build-and-tests.sh'. Once on-disk reverse indexes are proven out over several releases, we can change the default value of that configuration to 'true', and drop this patch. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Taylor Blau committed Jan 25, 2021 at 18:37 UTC e8c58f894b4d5369779e06ff7dc03fb0706c930a
5 files changed +13 -1
builtin/index-pack.c
+4 -1
@@ -1748,7 +1748,10 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
1748 if (prefix && chdir(prefix))
1749 die(_("Cannot come back to cwd"));
1750
1751 - rev_index = !!(opts.flags & (WRITE_REV_VERIFY | WRITE_REV));
1751 + if (git_env_bool(GIT_TEST_WRITE_REV_INDEX, 0))
1752 + rev_index = 1;
1753 + else
1754 + rev_index = !!(opts.flags & (WRITE_REV_VERIFY | WRITE_REV));
1755
1756 for (i = 1; i < argc; i++) {
1757 const char *arg = argv[i];
builtin/pack-objects.c
+2
@@ -3601,6 +3601,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
3601
3602 reset_pack_idx_option(&pack_idx_opts);
3603 git_config(git_pack_config, NULL);
3604 + if (git_env_bool(GIT_TEST_WRITE_REV_INDEX, 0))
3605 + pack_idx_opts.flags |= WRITE_REV;
3606
3607 progress = isatty(2);
3608 argc = parse_options(argc, argv, prefix, pack_objects_options,
ci/run-build-and-tests.sh
+1
@@ -24,6 +24,7 @@ linux-gcc)
24 export GIT_TEST_MULTI_PACK_INDEX=1
25 export GIT_TEST_ADD_I_USE_BUILTIN=1
26 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
27 + export GIT_TEST_WRITE_REV_INDEX=1
28 make test
29 ;;
30 linux-clang)
pack-revindex.h
+3
@@ -16,9 +16,12 @@
16 * can be found
17 */
18
19 +
20 #define RIDX_SIGNATURE 0x52494458 /* "RIDX" */
21 #define RIDX_VERSION 1
22
23 +#define GIT_TEST_WRITE_REV_INDEX "GIT_TEST_WRITE_REV_INDEX"
24 +
25 struct packed_git;
26
27 /*
t/README
+3
@@ -439,6 +439,9 @@ GIT_TEST_DEFAULT_HASH=<hash-algo> specifies which hash algorithm to
439 use in the test scripts. Recognized values for <hash-algo> are "sha1"
440 and "sha256".
441
442 +GIT_TEST_WRITE_REV_INDEX=<boolean>, when true enables the
443 +'pack.writeReverseIndex' setting.
444 +
445 Naming Tests
446 ------------
447