From: "Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Han-Wen Nienhuys <hanwenn@gmail.com>,
Han-Wen Nienhuys <hanwen@google.com>
Subject: [PATCH] init-db: init the_repository->hash_algo early from GIT_DEFAULT_HASH
Date: Thu, 26 Nov 2020 19:39:41 +0000 [thread overview]
Message-ID: <pull.924.git.git.1606419582190.gitgitgadget@gmail.com> (raw)
From: Han-Wen Nienhuys <hanwen@google.com>
The reftable backend needs to know the hash algorithm for writing the
initialization hash table.
The initial reftable contains a symref HEAD => "main" (or "master"), which is
agnostic to the size of hash value, but this is an exceptional circumstance, and
the reftable library does not cater for this exception. It insists that all
tables in the stack have a consistent format ID for the hash algorithm.
Call set_repo_hash_algo directly after reading out GIT_DEFAULT_HASH.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
init-db: init the_repository->hash_algo early from GIT_DEFAULT_HASH
The reftable backend needs to know the hash algorithm for writing the
initialization hash table.
The initial reftable contains a symref HEAD => "main" (or "master"),
which is agnostic to the size of hash value, but this is an exceptional
circumstance, and the reftable library does not cater for this
exception. It insists that all tables in the stack have a consistent
format ID for the hash algorithm.
Call set_repo_hash_algo directly after reading out GIT_DEFAULT_HASH.
Signed-off-by: Han-Wen Nienhuys hanwen@google.com [hanwen@google.com]
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-924%2Fhanwen%2Fset-hash-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-924/hanwen/set-hash-v1
Pull-Request: https://github.com/git/git/pull/924
builtin/init-db.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 01bc648d41..5c8c67fec6 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -391,6 +391,7 @@ static void validate_hash_algorithm(struct repository_format *repo_fmt, int hash
die(_("unknown hash algorithm '%s'"), env);
repo_fmt->hash_algo = env_algo;
}
+ repo_set_hash_algo(the_repository, repo_fmt->hash_algo);
}
int init_db(const char *git_dir, const char *real_git_dir,
base-commit: faefdd61ec7c7f6f3c8c9907891465ac9a2a1475
--
gitgitgadget
next reply other threads:[~2020-11-26 19:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-26 19:39 Han-Wen Nienhuys via GitGitGadget [this message]
2020-12-01 4:59 ` [PATCH] init-db: init the_repository->hash_algo early from GIT_DEFAULT_HASH Junio C Hamano
2020-12-03 20:23 ` Han-Wen Nienhuys
2020-12-03 23:25 ` Junio C Hamano
2020-12-07 11:52 ` Han-Wen Nienhuys
2020-12-07 19:31 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.924.git.git.1606419582190.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=hanwen@google.com \
--cc=hanwenn@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).