Skip to content

Commit e8c58f8

Browse files
ttaylorrgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 35a8a35 commit e8c58f8

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

builtin/index-pack.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,10 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
17481748
if (prefix && chdir(prefix))
17491749
die(_("Cannot come back to cwd"));
17501750

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));
17521755

17531756
for (i = 1; i < argc; i++) {
17541757
const char *arg = argv[i];

builtin/pack-objects.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3601,6 +3601,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
36013601

36023602
reset_pack_idx_option(&pack_idx_opts);
36033603
git_config(git_pack_config, NULL);
3604+
if (git_env_bool(GIT_TEST_WRITE_REV_INDEX, 0))
3605+
pack_idx_opts.flags |= WRITE_REV;
36043606

36053607
progress = isatty(2);
36063608
argc = parse_options(argc, argv, prefix, pack_objects_options,

ci/run-build-and-tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ linux-gcc)
2424
export GIT_TEST_MULTI_PACK_INDEX=1
2525
export GIT_TEST_ADD_I_USE_BUILTIN=1
2626
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
27+
export GIT_TEST_WRITE_REV_INDEX=1
2728
make test
2829
;;
2930
linux-clang)

pack-revindex.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
* can be found
1717
*/
1818

19+
1920
#define RIDX_SIGNATURE 0x52494458 /* "RIDX" */
2021
#define RIDX_VERSION 1
2122

23+
#define GIT_TEST_WRITE_REV_INDEX "GIT_TEST_WRITE_REV_INDEX"
24+
2225
struct packed_git;
2326

2427
/*

t/README

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,9 @@ GIT_TEST_DEFAULT_HASH=<hash-algo> specifies which hash algorithm to
439439
use in the test scripts. Recognized values for <hash-algo> are "sha1"
440440
and "sha256".
441441

442+
GIT_TEST_WRITE_REV_INDEX=<boolean>, when true enables the
443+
'pack.writeReverseIndex' setting.
444+
442445
Naming Tests
443446
------------
444447

0 commit comments

Comments
 (0)