summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/repack.c4
-rw-r--r--midx.c9
-rw-r--r--midx.h2
-rw-r--r--t/README4
-rwxr-xr-xt/t5310-pack-bitmaps.sh1
-rwxr-xr-xt/t5319-multi-pack-index.sh2
-rwxr-xr-xt/t9300-fast-import.sh2
7 files changed, 20 insertions, 4 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index 44965cb..26dcccd 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -553,6 +553,10 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
if (!no_update_server_info)
update_server_info(0);
remove_temporary_files();
+
+ if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0))
+ write_midx_file(get_object_directory());
+
string_list_clear(&names, 0);
string_list_clear(&rollback, 0);
string_list_clear(&existing_packs, 0);
diff --git a/midx.c b/midx.c
index 2243c91..1a6fa96 100644
--- a/midx.c
+++ b/midx.c
@@ -338,9 +338,14 @@ int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, i
struct multi_pack_index *m;
struct multi_pack_index *m_search;
int config_value;
+ static int env_value = -1;
- if (repo_config_get_bool(r, "core.multipackindex", &config_value) ||
- !config_value)
+ if (env_value < 0)
+ env_value = git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0);
+
+ if (!env_value &&
+ (repo_config_get_bool(r, "core.multipackindex", &config_value) ||
+ !config_value))
return 0;
for (m_search = r->objects->multi_pack_index; m_search; m_search = m_search->next)
diff --git a/midx.h b/midx.h
index 7e60907..2280160 100644
--- a/midx.h
+++ b/midx.h
@@ -3,6 +3,8 @@
#include "repository.h"
+#define GIT_TEST_MULTI_PACK_INDEX "GIT_TEST_MULTI_PACK_INDEX"
+
struct multi_pack_index {
struct multi_pack_index *next;
diff --git a/t/README b/t/README
index 3ea6c85..9d0277c 100644
--- a/t/README
+++ b/t/README
@@ -327,6 +327,10 @@ GIT_TEST_COMMIT_GRAPH=<boolean>, when true, forces the commit-graph to
be written after every 'git commit' command, and overrides the
'core.commitGraph' setting to true.
+GIT_TEST_MULTI_PACK_INDEX=<boolean>, when true, forces the multi-pack-
+index to be written after every 'git repack' command, and overrides the
+'core.multiPackIndex' setting to true.
+
Naming Tests
------------
diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
index 1be3459..82d7f7f 100755
--- a/t/t5310-pack-bitmaps.sh
+++ b/t/t5310-pack-bitmaps.sh
@@ -191,6 +191,7 @@ test_expect_success 'pack-objects respects --honor-pack-keep (local bitmapped pa
test_expect_success 'pack-objects respects --local (non-local bitmapped pack)' '
mv .git/objects/pack/$packbitmap.* alt.git/objects/pack/ &&
+ rm -f .git/objects/pack/multi-pack-index &&
test_when_finished "mv alt.git/objects/pack/$packbitmap.* .git/objects/pack/" &&
echo HEAD | git pack-objects --local --stdout --revs >3b.pack &&
git index-pack 3b.pack &&
diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
index 6f56b38..4024ff9 100755
--- a/t/t5319-multi-pack-index.sh
+++ b/t/t5319-multi-pack-index.sh
@@ -152,7 +152,7 @@ compare_results_with_midx "twelve packs"
test_expect_success 'repack removes multi-pack-index' '
test_path_is_file $objdir/pack/multi-pack-index &&
- git repack -adf &&
+ GIT_TEST_MULTI_PACK_INDEX=0 git repack -adf &&
test_path_is_missing $objdir/pack/multi-pack-index
'
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 40fe7e4..59a13b6 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -1558,7 +1558,7 @@ test_expect_success 'O: blank lines not necessary after other commands' '
INPUT_END
git fast-import <input &&
- test 8 = $(find .git/objects/pack -type f | wc -l) &&
+ test 8 = $(find .git/objects/pack -type f | grep -v multi-pack-index | wc -l) &&
test $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&
git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
test_cmp expect actual