Skip to content

Commit ff1e653

Browse files
ttaylorrgitster
authored andcommitted
midx: respect 'GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP'
Introduce a new 'GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP' environment variable to also write a multi-pack bitmap when 'GIT_TEST_MULTI_PACK_INDEX' is set. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4b58b6f commit ff1e653

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

builtin/repack.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
515515
if (!(pack_everything & ALL_INTO_ONE) ||
516516
!is_bare_repository())
517517
write_bitmaps = 0;
518+
} else if (write_bitmaps &&
519+
git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0) &&
520+
git_env_bool(GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP, 0)) {
521+
write_bitmaps = 0;
518522
}
519523
if (pack_kept_objects < 0)
520524
pack_kept_objects = write_bitmaps > 0;
@@ -725,8 +729,12 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
725729
update_server_info(0);
726730
remove_temporary_files();
727731

728-
if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0))
729-
write_midx_file(get_object_directory(), NULL, 0);
732+
if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0)) {
733+
unsigned flags = 0;
734+
if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP, 0))
735+
flags |= MIDX_WRITE_BITMAP | MIDX_WRITE_REV_INDEX;
736+
write_midx_file(get_object_directory(), NULL, flags);
737+
}
730738

731739
string_list_clear(&names, 0);
732740
string_list_clear(&rollback, 0);

ci/run-build-and-tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ linux-gcc)
2323
export GIT_TEST_COMMIT_GRAPH=1
2424
export GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1
2525
export GIT_TEST_MULTI_PACK_INDEX=1
26+
export GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1
2627
export GIT_TEST_ADD_I_USE_BUILTIN=1
2728
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
2829
export GIT_TEST_WRITE_REV_INDEX=1

midx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ struct pack_entry;
88
struct repository;
99

1010
#define GIT_TEST_MULTI_PACK_INDEX "GIT_TEST_MULTI_PACK_INDEX"
11+
#define GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP \
12+
"GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP"
1113

1214
struct multi_pack_index {
1315
struct multi_pack_index *next;

t/README

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,10 @@ GIT_TEST_MULTI_PACK_INDEX=<boolean>, when true, forces the multi-pack-
425425
index to be written after every 'git repack' command, and overrides the
426426
'core.multiPackIndex' setting to true.
427427

428+
GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=<boolean>, when true, sets the
429+
'--bitmap' option on all invocations of 'git multi-pack-index write',
430+
and ignores pack-objects' '--write-bitmap-index'.
431+
428432
GIT_TEST_SIDEBAND_ALL=<boolean>, when true, overrides the
429433
'uploadpack.allowSidebandAll' setting to true, and when false, forces
430434
fetch-pack to not request sideband-all (even if the server advertises

0 commit comments

Comments
 (0)