@@ -807,7 +807,8 @@ static int write_with_updates(struct packed_ref_store *refs,
}
strbuf_release(&sb);
- if (git_config_get_int("refs.packedrefsversion", &version)) {
+ if (!(version = git_env_ulong("GIT_TEST_PACKED_REFS_VERSION", 0)) &&
+ git_config_get_int("refs.packedrefsversion", &version)) {
/*
* Set the default depending on the current extension
* list. Default to version 1 if available, but allow a
@@ -732,8 +732,11 @@ int read_repository_format(struct repository_format *format, const char *path)
clear_repository_format(format);
/* Set default ref_format if no extensions.refFormat exists. */
- if (!format->ref_format_count)
+ if (!format->ref_format_count) {
format->ref_format = REF_FORMAT_FILES | REF_FORMAT_PACKED;
+ if (git_env_ulong("GIT_TEST_PACKED_REFS_VERSION", 0) == 2)
+ format->ref_format |= REF_FORMAT_PACKED_V2;
+ }
return format->version;
}
@@ -2,6 +2,9 @@
test_description='test across ref formats'
+GIT_TEST_PACKED_REFS_VERSION=0
+export GIT_TEST_PACKED_REFS_VERSION
+
. ./test-lib.sh
test_expect_success 'extensions.refFormat requires core.repositoryFormatVersion=1' '