diff options
| author | Junio C Hamano <gitster@pobox.com> | 2026-03-12 10:56:02 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-12 10:56:02 -0700 |
| commit | 8194f1795bf0ca36f245adccc84bc86ab2aa90d1 (patch) | |
| tree | c8d1bc1cc14dd618832cd9d2a5a932c33b27fd22 /repository.c | |
| parent | 7f19e4e1b6a3ad259e2ed66033e01e03b8b74c5e (diff) | |
| parent | d49f23ae2f9def3c9065738bccbb9ca8dfb4b0f0 (diff) | |
| download | git-8194f1795bf0ca36f245adccc84bc86ab2aa90d1.tar.xz | |
Merge branch 'bc/sha1-256-interop-02'
The code to maintain mapping between object names in multiple hash
functions is being added, written in Rust.
* bc/sha1-256-interop-02:
object-file-convert: always make sure object ID algo is valid
rust: add a small wrapper around the hashfile code
rust: add a new binary object map format
rust: add functionality to hash an object
rust: add a build.rs script for tests
rust: fix linking binaries with cargo
hash: expose hash context functions to Rust
write-or-die: add an fsync component for the object map
csum-file: define hashwrite's count as a uint32_t
rust: add additional helpers for ObjectID
hash: add a function to look up hash algo structs
rust: add a hash algorithm abstraction
rust: add a ObjectID struct
hash: use uint32_t for object_id algorithm
conversion: don't crash when no destination algo
repository: require Rust support for interoperability
Diffstat (limited to 'repository.c')
| -rw-r--r-- | repository.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/repository.c b/repository.c index 8717a1693a..0b8f7ec200 100644 --- a/repository.c +++ b/repository.c @@ -4,6 +4,7 @@ #include "hook.h" #include "odb.h" #include "config.h" +#include "gettext.h" #include "object.h" #include "lockfile.h" #include "path.h" @@ -39,7 +40,7 @@ struct repository *the_repository = &the_repo; static void set_default_hash_algo(struct repository *repo) { const char *hash_name; - int algo; + uint32_t algo; hash_name = getenv("GIT_TEST_DEFAULT_HASH_ALGO"); if (!hash_name) @@ -193,18 +194,23 @@ void repo_set_gitdir(struct repository *repo, repo->gitdir, "index"); } -void repo_set_hash_algo(struct repository *repo, int hash_algo) +void repo_set_hash_algo(struct repository *repo, uint32_t hash_algo) { repo->hash_algo = &hash_algos[hash_algo]; } -void repo_set_compat_hash_algo(struct repository *repo, int algo) +void repo_set_compat_hash_algo(struct repository *repo MAYBE_UNUSED, uint32_t algo) { +#ifdef WITH_RUST if (hash_algo_by_ptr(repo->hash_algo) == algo) BUG("hash_algo and compat_hash_algo match"); repo->compat_hash_algo = algo ? &hash_algos[algo] : NULL; if (repo->compat_hash_algo) repo_read_loose_object_map(repo); +#else + if (algo) + die(_("compatibility hash algorithm support requires Rust")); +#endif } void repo_set_ref_storage_format(struct repository *repo, |
