diff options
| author | brian m. carlson <sandals@crustytoothpaste.net> | 2023-10-01 21:40:25 -0500 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-10-02 14:57:40 -0700 |
| commit | 9ae702faf151802f481e68db8d5cb5b536b31c2a (patch) | |
| tree | 74f5c80e0ecee0ef6edf733fecd332c92ef74294 /setup.c | |
| parent | 2328ebaa4ef7a921c7021db9e83e122dbe2ac7ad (diff) | |
| download | git-9ae702faf151802f481e68db8d5cb5b536b31c2a.tar.gz | |
repository: implement extensions.compatObjectFormat
Add a configuration option to enable updating and reading from
compatibility hash maps when git accesses the reposotiry.
Call the helper function repo_set_compat_hash_algo with the value
that compatObjectFormat is set to.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'setup.c')
| -rw-r--r-- | setup.c | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -590,6 +590,25 @@ static enum extension_result handle_extension(const char *var, "extensions.objectformat", value); data->hash_algo = format; return EXTENSION_OK; + } else if (!strcmp(ext, "compatobjectformat")) { + struct string_list_item *item; + int format; + + if (!value) + return config_error_nonbool(var); + format = hash_algo_by_name(value); + if (format == GIT_HASH_UNKNOWN) + return error(_("invalid value for '%s': '%s'"), + "extensions.compatobjectformat", value); + /* For now only support compatObjectFormat being specified once. */ + for_each_string_list_item(item, &data->v1_only_extensions) { + if (!strcmp(item->string, "compatobjectformat")) + return error(_("'%s' already specified as '%s'"), + "extensions.compatobjectformat", + hash_algos[data->compat_hash_algo].name); + } + data->compat_hash_algo = format; + return EXTENSION_OK; } return EXTENSION_UNKNOWN; } @@ -1565,7 +1584,7 @@ const char *setup_git_directory_gently(int *nongit_ok) if (startup_info->have_repository) { repo_set_hash_algo(the_repository, repo_fmt.hash_algo); repo_set_compat_hash_algo(the_repository, - GIT_HASH_UNKNOWN); + repo_fmt.compat_hash_algo); the_repository->repository_format_worktree_config = repo_fmt.worktree_config; /* take ownership of repo_fmt.partial_clone */ @@ -1659,7 +1678,7 @@ void check_repository_format(struct repository_format *fmt) check_repository_format_gently(get_git_dir(), fmt, NULL); startup_info->have_repository = 1; repo_set_hash_algo(the_repository, fmt->hash_algo); - repo_set_compat_hash_algo(the_repository, GIT_HASH_UNKNOWN); + repo_set_compat_hash_algo(the_repository, fmt->compat_hash_algo); the_repository->repository_format_worktree_config = fmt->worktree_config; the_repository->repository_format_partial_clone = |
